]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux_h1: handle a possible strdup() failure
authorIlia Shipitsin <chipitsine@gmail.com>
Mon, 23 Dec 2024 21:00:48 +0000 (22:00 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 25 Dec 2024 11:42:33 +0000 (12:42 +0100)
This defect was found by the coccinelle script "unchecked-strdup.cocci".
It can be backported to all supported branches.

src/mux_h1.c

index 7eb18133dd206c9faa992ddf4b9509c7886b5b7b..a9363cd44dadc5344f367e2a80e402a5b69d7db8 100644 (file)
@@ -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" */