From 0a1738c877e5098030932cbf54768415fe25a7c1 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 21 Aug 2019 20:54:22 +0200 Subject: Fix "no attributes" sentinel value for xattr reader An inode can be of extended type for reasons other than having extended attributes and simply set the xattr ID to 0xFFFFFFFF to indicate that it doesn't have extended attributes. Signed-off-by: David Oberhollenzer --- lib/sqfs/xattr_reader.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/sqfs/xattr_reader.c') diff --git a/lib/sqfs/xattr_reader.c b/lib/sqfs/xattr_reader.c index 8859db8..99bd389 100644 --- a/lib/sqfs/xattr_reader.c +++ b/lib/sqfs/xattr_reader.c @@ -90,7 +90,8 @@ static int get_xattr_desc(xattr_reader_t *xr, uint32_t idx, size_t block, offset; if (idx >= xr->num_ids) { - fputs("Tried to access out of bounds xattr index\n", stderr); + fprintf(stderr, "Tried to access out of bounds " + "xattr index: 0x%08X\n", idx); return -1; } @@ -287,6 +288,9 @@ int xattr_reader_restore_node(xattr_reader_t *xr, fstree_t *fs, if (xr->kvrd == NULL || xr->idrd == NULL) return 0; + if (xattr == 0xFFFFFFFF) + return 0; + for (it = fs->xattr; it != NULL; it = it->next) { if (it->index == xattr) { node->xattr = it; -- cgit v1.2.3