diff options
author | Scott Lovenberg <scott.lovenberg@gmail.com> | 2010-05-11 09:32:34 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@samba.org> | 2010-05-11 09:32:34 -0400 |
commit | 400ebcb3bea6f21678b9e656d930a14bbd71fe7a (patch) | |
tree | 07e65a70a81412feee412ae3e8e064a2e9f8f23f | |
parent | e5d3ceb9958437ef50510a578b0274615a37bcf7 (diff) | |
download | cifs-utils-400ebcb3bea6f21678b9e656d930a14bbd71fe7a.tar.gz cifs-utils-400ebcb3bea6f21678b9e656d930a14bbd71fe7a.tar.bz2 cifs-utils-400ebcb3bea6f21678b9e656d930a14bbd71fe7a.zip |
mount.cifs: removed magic number for max username in parse_options
Replaced max username in parse_options with the sum of its potential
parts for "domain/user%password" formatted values. Note that forward
slashes still expand to a double back slash in the parse_username
function, though.
Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
-rw-r--r-- | mount.cifs.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mount.cifs.c b/mount.cifs.c index c4eb59a..127e6db 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -761,7 +761,11 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) return EX_USAGE; } } else { - if (strnlen(value, 260) >= 260) { + /* domain/username%password */ + const int max = MAX_DOMAIN_SIZE + + MAX_USERNAME_SIZE + + MOUNT_PASSWD_SIZE + 2; + if (strnlen(value, max + 1) >= max + 1) { fprintf(stderr, "username too long\n"); return EX_USAGE; } |