mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-12 16:57:05 -04:00
fuse-overlayfs: add check to readdir for the node parent
ensure the node was not moved and that its parent is the same as the directory we are reading. Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
This commit is contained in:
parent
3ff2c01cbb
commit
43b6b2ecf9
8
main.c
8
main.c
@ -1257,6 +1257,7 @@ ovl_lookup (fuse_req_t req, fuse_ino_t parent, const char *name)
|
||||
struct ovl_dirp
|
||||
{
|
||||
struct ovl_data *lo;
|
||||
struct ovl_node *parent;
|
||||
struct ovl_node **tbl;
|
||||
size_t tbl_size;
|
||||
size_t offset;
|
||||
@ -1304,6 +1305,7 @@ ovl_opendir (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
|
||||
goto out_errno;
|
||||
|
||||
d->offset = 0;
|
||||
d->parent = node;
|
||||
d->tbl_size = hash_get_n_entries (node->children) + 2;
|
||||
d->tbl = malloc (sizeof (struct ovl_node *) * d->tbl_size);
|
||||
if (d->tbl == NULL)
|
||||
@ -1460,7 +1462,11 @@ ovl_do_readdir (fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||
else if (offset == 1)
|
||||
name = "..";
|
||||
else
|
||||
name = node->name;
|
||||
{
|
||||
if (node->parent != d->parent)
|
||||
continue;
|
||||
name = node->name;
|
||||
}
|
||||
|
||||
if (!plus)
|
||||
entsize = fuse_add_direntry (req, p, remaining, name, &st, offset + 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user