Commit f4a69e06 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Greg Kroah-Hartman

fuse: readdir: check for slash in names

commit efeb9e60 upstream.

Userspace can add names containing a slash character to the directory
listing.  Don't allow this as it could cause all sorts of trouble.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
[bwh: Backported to 3.2: drop changes to parse_dirplusfile() which we
 don't have]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Cc: Rui Xiang <rui.xiang@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 831c8764
...@@ -1103,6 +1103,8 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file, ...@@ -1103,6 +1103,8 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file,
return -EIO; return -EIO;
if (reclen > nbytes) if (reclen > nbytes)
break; break;
if (memchr(dirent->name, '/', dirent->namelen) != NULL)
return -EIO;
over = filldir(dstbuf, dirent->name, dirent->namelen, over = filldir(dstbuf, dirent->name, dirent->namelen,
file->f_pos, dirent->ino, dirent->type); file->f_pos, dirent->ino, dirent->type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment