From: Miklos Szeredi Date: Tue, 3 Sep 2013 12:28:38 +0000 (+0200) Subject: fuse: readdir: check for slash in names X-Git-Tag: v3.2.52~98 X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5f9e3533584d2fb6c90c63da767b85421b07def;p=linux 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 [bwh: Backported to 3.2: drop changes to parse_dirplusfile() which we don't have] Signed-off-by: Ben Hutchings --- diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 2747103f76ed..06e2f73e64a8 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1063,6 +1063,8 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file, 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);