erofs-utils: fix random data in shared xattrs
There will be holes between xattr entry after EROFS_XATTR_ALIGN, so
we should clear shared xattrs buff to avoid random data.
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
Signed-off-by: Guo Weichao <guoweichao@oppo.com>
Link: https://lore.kernel.org/r/20201127083334.32738-1-huangjianan@oppo.com
Reviewed-by: Gao Xiang <hsiangkao@redhat.com>
Signed-off-by: Gao Xiang <hsiangkao@aol.com>
diff --git a/lib/xattr.c b/lib/xattr.c
index 1ce3fb3..f9ec78c 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -547,7 +547,7 @@
if (!shared_xattrs_size)
goto out;
- buf = malloc(shared_xattrs_size);
+ buf = calloc(1, shared_xattrs_size);
if (!buf)
return -ENOMEM;