aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2022-02-12 18:03:56 +0100
committerFabian Groffen <grobian@gentoo.org>2022-02-12 18:03:56 +0100
commitd314b816ef29bf1948cd9f747a22c2565e88bf76 (patch)
tree53867269a44af444a54cbdfbf04d1e81a86e4f44
parentqdepends: resolve Coverity resource leak CID 248875 (diff)
downloadportage-utils-d314b816ef29bf1948cd9f747a22c2565e88bf76.tar.gz
portage-utils-d314b816ef29bf1948cd9f747a22c2565e88bf76.tar.bz2
portage-utils-d314b816ef29bf1948cd9f747a22c2565e88bf76.zip
libq/tree: fix Coverity uninitialised memory use CID 248874
tree_read_file_pms was using buf, which was never initialised after some changes from the past remove entire buf, and use the paths from pkg and cat ctxs in the printfs directly Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--libq/tree.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libq/tree.c b/libq/tree.c
index 1e0e623..d71ee74 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -676,7 +676,6 @@ tree_read_file_pms(tree_pkg_ctx *pkg_ctx)
FILE *f;
tree_pkg_meta *ret = NULL;
size_t len;
- char buf[_Q_PATH_MAX];
if ((f = fdopen(pkg_ctx->fd, "r")) == NULL)
goto err;
@@ -695,7 +694,8 @@ tree_read_file_pms(tree_pkg_ctx *pkg_ctx)
ret->Q_DEPEND = ptr;
#define next_line(curr, next) \
if ((ptr = strchr(ret->Q_##curr, '\n')) == NULL) { \
- warn("Invalid cache file for '%s'", buf); \
+ warn("Invalid cache file for '%s/%s'", \
+ pkg_ctx->cat_ctx->name, pkg_ctx->name); \
goto err; \
} \
ret->Q_##next = ptr+1; \
@@ -718,8 +718,8 @@ tree_read_file_pms(tree_pkg_ctx *pkg_ctx)
#undef next_line
ptr = strchr(ptr+1, '\n');
if (ptr == NULL) {
- warn("Invalid cache file for '%s' - could not find end of cache data",
- buf);
+ warn("Invalid cache file for '%s/%s' - could not find end of cache data",
+ pkg_ctx->cat_ctx->name, pkg_ctx->name);
goto err;
}
*ptr = '\0';