diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2013-09-03 16:28:38 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-12 03:10:04 +0400 |
commit | f4a69e06dc99cd683fa001c49eb92da36fd76d1d (patch) | |
tree | b7626dcc5c153918d12bb171ea20bbccdd7f0c15 /fs/fuse | |
parent | 831c87640d23ccb253a02e4901bd9a325b5e8c2d (diff) | |
download | linux-f4a69e06dc99cd683fa001c49eb92da36fd76d1d.tar.xz |
fuse: readdir: check for slash in names
commit efeb9e60d48f7778fdcad4a0f3ad9ea9b19e5dfd 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: Miklos Szeredi <mszeredi@suse.cz>
[bwh: Backported to 3.2: drop changes to parse_dirplusfile() which we
don't have]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Rui Xiang <rui.xiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 373b25145e01..9966cae5a9e5 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1103,6 +1103,8 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file, return -EIO; if (reclen > nbytes) break; + if (memchr(dirent->name, '/', dirent->namelen) != NULL) + return -EIO; over = filldir(dstbuf, dirent->name, dirent->namelen, file->f_pos, dirent->ino, dirent->type); |