diff options
author | Jeff Layton <jlayton@samba.org> | 2012-11-09 06:08:38 -0500 |
---|---|---|
committer | Jeff Layton <jlayton@samba.org> | 2012-11-09 06:08:38 -0500 |
commit | feab5b327c5fea393d626f0ae3c33810fdafe518 (patch) | |
tree | c3a69af14c51b9333e9c2213ff4eab0540f35794 | |
parent | fd3d58c4e78098700a03551c7e7d2f2b63777502 (diff) | |
download | cifs-utils-feab5b327c5fea393d626f0ae3c33810fdafe518.tar.gz cifs-utils-feab5b327c5fea393d626f0ae3c33810fdafe518.tar.bz2 cifs-utils-feab5b327c5fea393d626f0ae3c33810fdafe518.zip |
mount.cifs: fix argument count check
The argv < 3 check could return true if you pass in some option flags.
If you don't provide any further arguments then you might just walk
off the end of the argv array. The values past the end aren't
guaranteed to be NULL in that case.
Fix the check to just look at whether there are 2 more arguments after
the getopt processing is done.
Signed-off-by: Jeff Layton <jlayton@samba.org>
-rw-r--r-- | mount.cifs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mount.cifs.c b/mount.cifs.c index 9cf58a5..a9632b4 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -2071,7 +2071,7 @@ int main(int argc, char **argv) } } - if (argc < 3 || argv[optind] == NULL || argv[optind + 1] == NULL) { + if (argc < optind + 2) { rc = mount_usage(stderr); goto mount_exit; } |