parse_one_xattr() will return null if it detects unidentified xattr.
In such cases we need to skip this xattr which was our intention than
try to add it in erofs_xattr_add() which results in null pointer
dereference.

Fixes: 3037f8958f3b ("erofs-utils: skip all unidentified xattrs from local 
paths")
Signed-off-by: Sandeep Dhavale <dhav...@google.com>
---
 lib/xattr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/xattr.c b/lib/xattr.c
index 651657f..9f31f2d 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -448,6 +448,9 @@ static int read_xattrs_from_file(const char *path, mode_t 
mode,
                        ret = PTR_ERR(item);
                        goto err;
                }
+               /* skip unidentified xattrs */
+               if (!item)
+                       continue;
 
                ret = erofs_xattr_add(ixattrs, item);
                if (ret < 0)
-- 
2.46.0.184.g6999bdac58-goog

Reply via email to