aboutsummaryrefslogtreecommitdiffstats
path: root/mount.cifs.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2012-11-09 06:08:38 -0500
committerJeff Layton <jlayton@samba.org>2012-11-09 06:08:38 -0500
commitfeab5b327c5fea393d626f0ae3c33810fdafe518 (patch)
treec3a69af14c51b9333e9c2213ff4eab0540f35794 /mount.cifs.c
parentfd3d58c4e78098700a03551c7e7d2f2b63777502 (diff)
downloadcifs-utils-feab5b327c5fea393d626f0ae3c33810fdafe518.tar.gz
cifs-utils-feab5b327c5fea393d626f0ae3c33810fdafe518.tar.xz
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>
Diffstat (limited to 'mount.cifs.c')
-rw-r--r--mount.cifs.c2
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;
}