Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/
Date: Sun, 19 Jan 2020 19:09:16
Message-Id: 1579457647.c4e0ef9df105c2a1459d283cd3d977fcd31d363d.grobian@gentoo
1 commit: c4e0ef9df105c2a1459d283cd3d977fcd31d363d
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 19 18:14:07 2020 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 19 18:14:07 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c4e0ef9d
7
8 libq/tree: fix Coverity 206551 String not null terminated
9
10 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
11
12 libq/tree.c | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15 diff --git a/libq/tree.c b/libq/tree.c
16 index 2efdb7c..9645237 100644
17 --- a/libq/tree.c
18 +++ b/libq/tree.c
19 @@ -618,10 +618,11 @@ tree_read_file_pms(tree_pkg_ctx *pkg_ctx)
20 goto err;
21
22 len = sizeof(*ret) + s.st_size + 1;
23 - ret = xzalloc(len);
24 + ret = xmalloc(len);
25 ptr = (char*)ret + sizeof(*ret);
26 if ((off_t)fread(ptr, 1, s.st_size, f) != s.st_size)
27 goto err;
28 + ptr[s.st_size] = '\0';
29
30 ret->Q_DEPEND = ptr;
31 #define next_line(curr, next) \