From: William Lallemand Date: Mon, 23 Mar 2026 20:48:36 +0000 (+0100) Subject: BUILD: tools: potential null pointer dereference in dl_collect_libs_cb X-Git-Tag: v3.4-dev8~111 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=33041fe91fe47c6e6e24fb945fca3f37cd4ad0ab;p=thirdparty%2Fhaproxy.git BUILD: tools: potential null pointer dereference in dl_collect_libs_cb This patch fixes a warning that can be reproduced with gcc-8.5 on RHEL8 (gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-28)). This should fix issue #3303. Must be backported everywhere 917e82f283 ("MINOR: debug: copy debug symbols from /usr/lib/debug when present") was backported, which is to branch 3.2 for now. --- diff --git a/src/tools.c b/src/tools.c index bae43643a..49398ae3d 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6057,6 +6057,9 @@ static int dl_collect_libs_cb(struct dl_phdr_info *info, size_t size, void *data /* else it's a VDSO or similar and we're not interested */ goto leave; + if (!fname) + goto leave; + load_file_into_tar(&ctx->storage, &ctx->size, ctx->prefix, fname, NULL, "haproxy-libs-dump"); /* try to load equivalent debug symbols for absolute paths */