hello_ll: Fix null pointer dereference (#363)
authorForty-Bot <Forty-Bot@users.noreply.github.com>
Mon, 25 Feb 2019 21:06:42 +0000 (16:06 -0500)
committerNikolaus Rath <Nikolaus@rath.org>
Mon, 25 Feb 2019 21:06:42 +0000 (21:06 +0000)
If hello_ll is invoked without a mountpoint, it will try to call
fuse_session_mount anyway with the NULL mountpoint (which then causes a
segfault). Print out a short help message instead (taken from
passthrough_ll.c).

example/hello_ll.c

index 601cf93f386bbb32237fcaa64c96f6586911af28..97f3c506aa28e990b137cedc91c76ed459c2493f 100644 (file)
@@ -183,6 +183,13 @@ int main(int argc, char *argv[])
                goto err_out1;
        }
 
+       if(opts.mountpoint == NULL) {
+               printf("usage: %s [options] <mountpoint>\n", argv[0]);
+               printf("       %s --help\n", argv[0]);
+               ret = 1;
+               goto err_out1;
+       }
+
        se = fuse_session_new(&args, &hello_ll_oper,
                              sizeof(hello_ll_oper), NULL);
        if (se == NULL)