commit: 2908db2103ce564c9e26c8c8cc354bb69cd3065e
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 24 18:09:40 2026 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Jan 24 18:09:40 2026 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=2908db21
libq/tree: fix crashes/invalid accesses from tree_pkg_xpak_read_cb
Regression after changing this to be more efficient.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
libq/tree.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libq/tree.c b/libq/tree.c
index 85e6c20..11872d7 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -944,7 +944,7 @@ static void tree_pkg_xpak_read_cb
char *data)
{
tree_pkg_ctx *pkg = ctx;
- char **key;
+ char **key = NULL;
if (pathname_len < 3)
return;
@@ -1009,7 +1009,8 @@ static void tree_pkg_xpak_read_cb
}
/* don't overwrite entries */
- if (*key != NULL)
+ if (key == NULL ||
+ *key != NULL)
return;
/* trim whitespace (mostly trailing newline) */