From: Ilia Shipitsin Date: Mon, 23 Dec 2024 21:00:48 +0000 (+0100) Subject: BUG/MINOR: mux_h1: handle a possible strdup() failure X-Git-Tag: v3.2-dev2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3e6c783cd39bb630b73a15ff91f1a287f421c25;p=thirdparty%2Fhaproxy.git BUG/MINOR: mux_h1: handle a possible strdup() failure This defect was found by the coccinelle script "unchecked-strdup.cocci". It can be backported to all supported branches. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index 7eb18133dd..a9363cd44d 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -5663,7 +5663,11 @@ static int cfg_parse_h1_headers_case_adjust_file(char **args, int section_type, } free(hdrs_map.name); hdrs_map.name = strdup(args[1]); - return 0; + if (!hdrs_map.name) { + memprintf(err, "'%s %s' : out of memory", args[0], args[1]); + return -1; + } + return 0; } /* config parser for global "tune.h1.zero-copy-fwd-recv" */