diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2018-11-24 20:24:10 +0000 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2018-11-24 20:55:23 +0000 |
commit | c3c3a500a5ef00456f9e555448071f8520aee8a4 (patch) | |
tree | 40ae341aa6c31b5c2378ce81654347ebcec87a9f /example | |
parent | b35afb000a08dd899556592e6f1dff3c5ea61d71 (diff) | |
download | libfuse-c3c3a500a5ef00456f9e555448071f8520aee8a4.tar.gz |
Fixed lookup-count leak in do_readdir().
Diffstat (limited to 'example')
-rw-r--r-- | example/passthrough_ll.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c index 5cca531..a745220 100644 --- a/example/passthrough_ll.c +++ b/example/passthrough_ll.c @@ -700,9 +700,9 @@ static void lo_do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, } nextoff = telldir(d->dp); name = d->entry->d_name; + fuse_ino_t entry_ino = 0; if (plus) { struct fuse_entry_param e; - if (is_dot_or_dotdot(name)) { e = (struct fuse_entry_param) { .attr.st_ino = d->entry->d_ino, @@ -712,6 +712,7 @@ static void lo_do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, err = lo_do_lookup(req, ino, name, &e); if (err) goto error; + entry_ino = e.ino; } entsize = fuse_add_direntry_plus(req, p, rem, name, @@ -724,9 +725,12 @@ static void lo_do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, entsize = fuse_add_direntry(req, p, rem, name, &st, nextoff); } - if (entsize > rem) + if (entsize > rem) { + if (entry_ino != 0) + lo_forget_one(req, entry_ino, 1); break; - + } + p += entsize; rem -= entsize; |