From: Egor Shestakov Date: Thu, 5 Feb 2026 08:55:58 +0000 (+0000) Subject: BUG/MINOR: startup: handle a possible strdup() failure X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a07dc9c24b8293920fc24ca248e8b2a5c06130d;p=thirdparty%2Fhaproxy.git BUG/MINOR: startup: handle a possible strdup() failure Fix unhandled strdup() failure when initializing global.log_tag. Bug was introduced with the fix UAF for global progname pointer from 351ae5dbe. So it must be backported as far as 3.1. --- diff --git a/src/haproxy.c b/src/haproxy.c index 0ae755faa..48186a66a 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1441,6 +1441,10 @@ static void init_early(int argc, char **argv) } chunk_initlen(&global.log_tag, strdup(progname), len, len); + if (b_orig(&global.log_tag) == NULL) { + ha_alert("Cannot allocate memory for log_tag.\n"); + exit(EXIT_FAILURE); + } } /* handles program arguments. Very minimal parsing is performed, variables are