X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fext3%2Fxattr_user.c;h=e907cae7a07c34617983bf808125e1a526235801;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=84877afff67a0cece30bfbfee4188440f7ae81e0;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c index 84877afff..e907cae7a 100644 --- a/fs/ext3/xattr_user.c +++ b/fs/ext3/xattr_user.c @@ -16,20 +16,21 @@ #define XATTR_USER_PREFIX "user." static size_t -ext3_xattr_user_list(char *list, struct inode *inode, - const char *name, int name_len) +ext3_xattr_user_list(struct inode *inode, char *list, size_t list_size, + const char *name, size_t name_len) { - const int prefix_len = sizeof(XATTR_USER_PREFIX)-1; + const size_t prefix_len = sizeof(XATTR_USER_PREFIX)-1; + const size_t total_len = prefix_len + name_len + 1; if (!test_opt(inode->i_sb, XATTR_USER)) return 0; - if (list) { + if (list && total_len <= list_size) { memcpy(list, XATTR_USER_PREFIX, prefix_len); memcpy(list+prefix_len, name, name_len); list[prefix_len + name_len] = '\0'; } - return prefix_len + name_len + 1; + return total_len; } static int @@ -70,7 +71,7 @@ ext3_xattr_user_set(struct inode *inode, const char *name, value, size, flags); } -struct ext3_xattr_handler ext3_xattr_user_handler = { +struct xattr_handler ext3_xattr_user_handler = { .prefix = XATTR_USER_PREFIX, .list = ext3_xattr_user_list, .get = ext3_xattr_user_get,