aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorGravatar Przemyslaw Pawelczyk <przemoc@gmail.com>2016-11-28 14:41:37 +0100
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-11-28 21:35:05 -0800
commita3fda25b7d2205094241c48e368a383c25920512 (patch)
treee275dbef04a864245cbd48423f498c4f55a9666d /example
parentdfbfee07abc9329715a12ce251e0ceeda8d78f19 (diff)
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.
Diffstat (limited to 'example')
-rw-r--r--example/passthrough_ll.c3
1 files changed, 2 insertions, 1 deletions
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)