From 3ac6d8663740a7018d4e50778dc67f372afbddb1 Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Mon, 20 Mar 2023 11:02:27 +0100
Subject: [PATCH 1/1] xattr: fix the name in error message

Commit 744ca24fd680eb0535b251e801be10195d2ffcfb changed to no longer
copy the name, but we need it. Mess with p only after we used it.

Fixes #234
---
 squashfs-tools/xattr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/squashfs-tools/xattr.c b/squashfs-tools/xattr.c
index 32343f5..a46eb1f 100644
--- a/squashfs-tools/xattr.c
+++ b/squashfs-tools/xattr.c
@@ -219,15 +219,15 @@ static int read_xattrs_from_system(struct dir_ent *dir_ent, char *filename,
 		xattr_list = x;
 
 		xattr_list[i].type = xattr_get_prefix(&xattr_list[i], p);
-		p += strlen(p) + 1;
 
 		if(xattr_list[i].type == -1) {
-			ERROR("Unrecognised xattr prefix %s\n",
-				xattr_list[i].full_name);
-			free(xattr_list[i].full_name);
+			ERROR("Unrecognised xattr prefix %s\n", p);
+			p += strlen(p) + 1;
 			continue;
 		}
 
+		p += strlen(p) + 1;
+
 		while(1) {
 			vsize = lgetxattr(filename, xattr_list[i].full_name,
 								NULL, 0);
-- 
2.40.0
