From d314b816ef29bf1948cd9f747a22c2565e88bf76 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 12 Feb 2022 18:03:56 +0100 Subject: 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 --- libq/tree.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libq') 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'; -- cgit v1.2.3-65-gdbad