From 55ba0d6865662036d1d137dc4aac3841d29ad6d3 Mon Sep 17 00:00:00 2001 From: Remi Tricot-Le Breton Date: Wed, 12 May 2021 18:04:46 +0200 Subject: [PATCH] BUG/MINOR: proxy: Missing calloc return value check in proxy_parse_declare A memory allocation failure happening during proxy_parse_declare while processing the "capture" keyword and allocating a cap_hdr structure would have resulted in a crash. This function is only called during configuration parsing. It was raised in GitHub issue #1233. It could be backported to all stable branches. --- src/proxy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/proxy.c b/src/proxy.c index ce60df0..079280c 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -756,6 +756,10 @@ static int proxy_parse_declare(char **args, int section, struct proxy *curpx, /* register the capture. */ hdr = calloc(1, sizeof(*hdr)); + if (!hdr) { + memprintf(err, "proxy '%s': out of memory while registering a capture", curpx->id); + return -1; + } hdr->name = NULL; /* not a header capture */ hdr->namelen = 0; hdr->len = len; -- 1.7.10.4