diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2013-09-03 08:28:38 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2013-09-03 08:28:38 -0400 |
commit | efeb9e60d48f7778fdcad4a0f3ad9ea9b19e5dfd (patch) | |
tree | 3cade63dc511e557d9f99cfb810d2d3c64351e4b /fs/fuse/dir.c | |
parent | 06a7c3c2781409af95000c60a5df743fd4e2f8b4 (diff) |
fuse: readdir: check for slash in names
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>
Cc: stable@vger.kernel.org
Diffstat (limited to 'fs/fuse/dir.c')
-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 c8334f75c8c9..8fec28ff4a0d 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1174,6 +1174,8 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file, | |||
1174 | return -EIO; | 1174 | return -EIO; |
1175 | if (reclen > nbytes) | 1175 | if (reclen > nbytes) |
1176 | break; | 1176 | break; |
1177 | if (memchr(dirent->name, '/', dirent->namelen) != NULL) | ||
1178 | return -EIO; | ||
1177 | 1179 | ||
1178 | if (!dir_emit(ctx, dirent->name, dirent->namelen, | 1180 | if (!dir_emit(ctx, dirent->name, dirent->namelen, |
1179 | dirent->ino, dirent->type)) | 1181 | dirent->ino, dirent->type)) |
@@ -1320,6 +1322,8 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file, | |||
1320 | return -EIO; | 1322 | return -EIO; |
1321 | if (reclen > nbytes) | 1323 | if (reclen > nbytes) |
1322 | break; | 1324 | break; |
1325 | if (memchr(dirent->name, '/', dirent->namelen) != NULL) | ||
1326 | return -EIO; | ||
1323 | 1327 | ||
1324 | if (!over) { | 1328 | if (!over) { |
1325 | /* We fill entries into dstbuf only as much as | 1329 | /* We fill entries into dstbuf only as much as |