commit:     516713c50ef9af3b05091d243577d64ec787a7a7
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 26 17:06:08 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jan 26 17:06:08 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=516713c5

libq/tree: skip empty values in tree_pkg_binpkg_read, CID 557239

Technically we can have 0-length values, and a yet uninitialised data
buffer, causing a call to tree_pkg_xpak_read_cb with a NULL-pointer.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/tree.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libq/tree.c b/libq/tree.c
index 4844e088..34b82a11 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -1089,6 +1089,9 @@ static bool tree_pkg_binpkg_read
         fname++;
 
         data_len = archive_entry_size(entry);
+        if (data_len == 0)
+          continue;
+
         if (data_len > data_size) {
           data_size = data_len;
           data      = xrealloc(data, data_size);

Reply via email to