aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-08-23 21:19:10 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-08-31 19:19:06 +0200
commit05202734be03d8fd65bb6df298f3ceaf58ee5995 (patch)
tree46b54e3135e9a24a97d1e6616386c38c9c17b3aa
parent1ede6221fa3931ed2e8efc4ea28ee69fbabc2481 (diff)
Hardlink search: report error if cannonicalization fails
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/common/hardlink.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/common/hardlink.c b/lib/common/hardlink.c
index 4657bc3..e43df33 100644
--- a/lib/common/hardlink.c
+++ b/lib/common/hardlink.c
@@ -32,7 +32,7 @@ static int map_nodes(rbtree_t *inumtree, sqfs_hard_link_t **out,
}
if (!is_filename_sane((const char *)n->name, false))
- return 0;
+ return SQFS_ERROR_CORRUPTED;
idx = n->inode->base.inode_number;
tn = rbtree_lookup(inumtree, &idx);
@@ -53,13 +53,14 @@ static int map_nodes(rbtree_t *inumtree, sqfs_hard_link_t **out,
return ret;
}
- if (canonicalize_name(lnk->target) == 0) {
- lnk->next = (*out);
- (*out) = lnk;
- } else {
+ if (canonicalize_name(lnk->target) != 0) {
sqfs_free(lnk->target);
free(lnk);
+ return SQFS_ERROR_CORRUPTED;
}
+
+ lnk->next = (*out);
+ (*out) = lnk;
return 0;
}