[PATCH] erofs-utils: lib: fix sorting shared xattrs

Gao Xiang xiang at kernel.org
Sat Sep 14 01:39:14 AEST 2024


Hi Yong,

On Fri, Sep 13, 2024 at 10:35:42PM +0800, Sheng Yong via Linux-erofs wrote:
> The length of xattr_item->kvbuf is calculated by EROFS_XATTR_KVSIZE,
> and the key part has a trailing '\0' before the value part. When qsort
> compares two xattr_items, the key-value length should be calculated by
> EROFS_XATTR_KVSIZE, and use memcmp instead of strncmp to avoid key-value
> string being cut by '\0'.
> 
> Fixes: 5df285cf405d ("erofs-utils: lib: refactor extended attribute name prefixes")
> Signed-off-by: Sheng Yong <shengyong at oppo.com>

Yeah, good catch! And many thanks for fixing this!
Reviewed-by: Gao Xiang <hsiangkao at linux.alibaba.com>

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list