Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+4
+4
fs/fuse/dir.c
··· 1174 1174 return -EIO; 1175 1175 if (reclen > nbytes) 1176 1176 break; 1177 + if (memchr(dirent->name, '/', dirent->namelen) != NULL) 1178 + return -EIO; 1177 1179 1178 1180 if (!dir_emit(ctx, dirent->name, dirent->namelen, 1179 1181 dirent->ino, dirent->type)) ··· 1322 1320 return -EIO; 1323 1321 if (reclen > nbytes) 1324 1322 break; 1323 + if (memchr(dirent->name, '/', dirent->namelen) != NULL) 1324 + return -EIO; 1325 1325 1326 1326 if (!over) { 1327 1327 /* We fill entries into dstbuf only as much as