Skip to content

Commit efeb9e6

Browse files
author
Miklos Szeredi
committed
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
1 parent 06a7c3c commit efeb9e6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/fuse/dir.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,8 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file,
11741174
return -EIO;
11751175
if (reclen > nbytes)
11761176
break;
1177+
if (memchr(dirent->name, '/', dirent->namelen) != NULL)
1178+
return -EIO;
11771179

11781180
if (!dir_emit(ctx, dirent->name, dirent->namelen,
11791181
dirent->ino, dirent->type))
@@ -1320,6 +1322,8 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file,
13201322
return -EIO;
13211323
if (reclen > nbytes)
13221324
break;
1325+
if (memchr(dirent->name, '/', dirent->namelen) != NULL)
1326+
return -EIO;
13231327

13241328
if (!over) {
13251329
/* We fill entries into dstbuf only as much as

0 commit comments

Comments
 (0)