diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2013-09-03 08:28:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-26 20:18:30 -0400 |
commit | e5362560a01dd6fac5922434e16b16a1accea504 (patch) | |
tree | ed7744c4b7d4cc07328f3497d0c10597524f1f24 | |
parent | 4e208303119d234347b1f4337b84d47306e73811 (diff) |
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/fuse/dir.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index a30c60d5ce4f..e67b13de2ebc 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1175,6 +1175,8 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file, | |||
1175 | return -EIO; | 1175 | return -EIO; |
1176 | if (reclen > nbytes) | 1176 | if (reclen > nbytes) |
1177 | break; | 1177 | break; |
1178 | if (memchr(dirent->name, '/', dirent->namelen) != NULL) | ||
1179 | return -EIO; | ||
1178 | 1180 | ||
1179 | over = filldir(dstbuf, dirent->name, dirent->namelen, | 1181 | over = filldir(dstbuf, dirent->name, dirent->namelen, |
1180 | file->f_pos, dirent->ino, dirent->type); | 1182 | file->f_pos, dirent->ino, dirent->type); |
@@ -1323,6 +1325,8 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file, | |||
1323 | return -EIO; | 1325 | return -EIO; |
1324 | if (reclen > nbytes) | 1326 | if (reclen > nbytes) |
1325 | break; | 1327 | break; |
1328 | if (memchr(dirent->name, '/', dirent->namelen) != NULL) | ||
1329 | return -EIO; | ||
1326 | 1330 | ||
1327 | if (!over) { | 1331 | if (!over) { |
1328 | /* We fill entries into dstbuf only as much as | 1332 | /* We fill entries into dstbuf only as much as |