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