]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mount.ceph: option parsing fix
authorSamuel Just <samuel.just@dreamhost.com>
Wed, 2 Feb 2011 21:35:21 +0000 (13:35 -0800)
committerSamuel Just <samuel.just@dreamhost.com>
Wed, 2 Feb 2011 22:33:54 +0000 (14:33 -0800)
Passing -o secretfile would cause a segfault since searching for = would
result in a null pointer.  New version checks for that case.  Also, *end
cannot be a ,.

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/mount/mount.ceph.c

index db0581ee2b85351f9e10162a721885746e10564b..b4e687cbcd6c2b35add4b31311233123cfc99b08 100755 (executable)
@@ -248,7 +248,12 @@ static char *parse_options(const char *data, int *filesys_flags)
                        int fd;
                        int len;
 
-                       while (*end && *end != ',')
+                       if (!fn || !*fn) {
+                               printf("keyword secretfile found, but no secret file specified\n");
+                               return NULL;
+                       }
+
+                       while (*end)
                                end++;
                        fd = open(fn, O_RDONLY);
                        if (fd < 0) {