commit:     d30b9831b8fd3ea1333b333ebb20d83adbc30b75
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  3 13:06:22 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Jan  3 13:06:22 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d30b9831

libq/atom: fix infinite loop in atom_explode_cat for build_id check

Bug: https://bugs.gentoo.org/968289
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/atom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libq/atom.c b/libq/atom.c
index 5c9a165..ef1d1b7 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -140,8 +140,10 @@ atom_explode_cat(const char *atom, const char *cat)
                        if (valid &&
                                *ptr == '-')
                        {
-                               pv = ret->CATEGORY;
-                               while ((pv = strchr(pv, '-')) != NULL) {
+                               for (pv = ret->CATEGORY;
+                                        (pv = strchr(pv, '-')) != NULL;
+                                        pv++)
+                               {
                                        if (isdigit(pv[1]))
                                                break;
                                }

Reply via email to