aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2020-01-19 19:14:07 +0100
committerFabian Groffen <grobian@gentoo.org>2020-01-19 19:14:07 +0100
commitc4e0ef9df105c2a1459d283cd3d977fcd31d363d (patch)
tree6b8750b8f4d3a1f1215deffbd0150b0b1e424098 /libq/tree.c
parentqsize: fix Coverity 206552 Invalid printf format string (diff)
downloadportage-utils-c4e0ef9df105c2a1459d283cd3d977fcd31d363d.tar.gz
portage-utils-c4e0ef9df105c2a1459d283cd3d977fcd31d363d.tar.bz2
portage-utils-c4e0ef9df105c2a1459d283cd3d977fcd31d363d.zip
libq/tree: fix Coverity 206551 String not null terminated
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'libq/tree.c')
-rw-r--r--libq/tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libq/tree.c b/libq/tree.c
index 2efdb7c..9645237 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -618,10 +618,11 @@ tree_read_file_pms(tree_pkg_ctx *pkg_ctx)
goto err;
len = sizeof(*ret) + s.st_size + 1;
- ret = xzalloc(len);
+ ret = xmalloc(len);
ptr = (char*)ret + sizeof(*ret);
if ((off_t)fread(ptr, 1, s.st_size, f) != s.st_size)
goto err;
+ ptr[s.st_size] = '\0';
ret->Q_DEPEND = ptr;
#define next_line(curr, next) \