commit: 85355e52d5adaf79c8c69ae5dc46ebc62a2c8cde
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 19 17:56:41 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 19 17:56:41 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=85355e52
qlist: fix Coverity 206555 Out-of-bounds read
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
qlist.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qlist.c b/qlist.c
index 506e3e5..cd60083 100644
--- a/qlist.c
+++ b/qlist.c
@@ -277,9 +277,9 @@ qlist_match(
/* let's try exact matching w/out the PV */
i = snprintf(buf, sizeof(buf), "%s/%s", atom->CATEGORY,
atom->PN);
- if (uslot[0] != '\0' && i <= (int)sizeof(buf))
+ if (uslot[0] != '\0' && i < (int)sizeof(buf))
i += snprintf(buf + i, sizeof(buf) - i, ":%s",
atom->SLOT);
- if (urepo && i <= (int)sizeof(buf))
+ if (urepo && i < (int)sizeof(buf))
i += snprintf(buf + i, sizeof(buf) - i, "::%s",
atom->REPO);
/* exact match: CAT/PN[:SLOT][::REPO] */