Commit 63401ccd authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: limit xattr returned size

Don't let userspace filesystem give bogus values for the size of xattr and
xattr list.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 4680a7ee
...@@ -79,7 +79,7 @@ ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value, ...@@ -79,7 +79,7 @@ ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value,
} }
ret = fuse_simple_request(fc, &args); ret = fuse_simple_request(fc, &args);
if (!ret && !size) if (!ret && !size)
ret = outarg.size; ret = min_t(ssize_t, outarg.size, XATTR_SIZE_MAX);
if (ret == -ENOSYS) { if (ret == -ENOSYS) {
fc->no_getxattr = 1; fc->no_getxattr = 1;
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
...@@ -138,7 +138,7 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) ...@@ -138,7 +138,7 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
} }
ret = fuse_simple_request(fc, &args); ret = fuse_simple_request(fc, &args);
if (!ret && !size) if (!ret && !size)
ret = outarg.size; ret = min_t(ssize_t, outarg.size, XATTR_LIST_MAX);
if (ret > 0 && size) if (ret > 0 && size)
ret = fuse_verify_xattr_list(list, ret); ret = fuse_verify_xattr_list(list, ret);
if (ret == -ENOSYS) { if (ret == -ENOSYS) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment