| From efeb9e60d48f7778fdcad4a0f3ad9ea9b19e5dfd Mon Sep 17 00:00:00 2001 |
| From: Miklos Szeredi <mszeredi@suse.cz> |
| Date: Tue, 3 Sep 2013 14:28:38 +0200 |
| Subject: fuse: readdir: check for slash in names |
| |
| From: Miklos Szeredi <mszeredi@suse.cz> |
| |
| 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> |
| |
| --- |
| fs/fuse/dir.c | 4 ++++ |
| 1 file changed, 4 insertions(+) |
| |
| --- a/fs/fuse/dir.c |
| +++ b/fs/fuse/dir.c |
| @@ -1175,6 +1175,8 @@ static int parse_dirfile(char *buf, size |
| 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); |
| @@ -1323,6 +1325,8 @@ static int parse_dirplusfile(char *buf, |
| return -EIO; |
| if (reclen > nbytes) |
| break; |
| + if (memchr(dirent->name, '/', dirent->namelen) != NULL) |
| + return -EIO; |
| |
| if (!over) { |
| /* We fill entries into dstbuf only as much as |