From a3fda25b7d2205094241c48e368a383c25920512 Mon Sep 17 00:00:00 2001 From: Przemyslaw Pawelczyk Date: Mon, 28 Nov 2016 14:41:37 +0100 Subject: examples/passthrough_ll.c: Fix segfault when showing help or version. root lo_inode's next and prev were not set early enough, which led to accessing addr 0x8 (or 0x4, depending on ptr size) when setting prev variable in lo_free(lo.root.next), because lo.root.next was NULL. --- example/passthrough_ll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'example') diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c index 995026e..9c6144a 100644 --- a/example/passthrough_ll.c +++ b/example/passthrough_ll.c @@ -463,6 +463,8 @@ int main(int argc, char *argv[]) struct lo_data lo = { .debug = 0 }; int ret = -1; + lo.root.next = lo.root.prev = &lo.root; + if (fuse_parse_cmdline(&args, &opts) != 0) return 1; if (opts.show_help) { @@ -479,7 +481,6 @@ int main(int argc, char *argv[]) } lo.debug = opts.debug; - lo.root.next = lo.root.prev = &lo.root; lo.root.fd = open("/", O_PATH); lo.root.nlookup = 2; if (lo.root.fd == -1) -- cgit v1.2.3