From: Aurelien DARRAGON Date: Thu, 2 Nov 2023 08:18:55 +0000 (+0100) Subject: BUG/MINOR: stktable: missing free in parse_stick_table() X-Git-Tag: v2.9-dev9~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6376fe91427239c8650fba90166de8b0b396cf0b;p=thirdparty%2Fhaproxy.git BUG/MINOR: stktable: missing free in parse_stick_table() When "peers" keyword is encountered within a stick table definition, peers.name hint gets replaced with a new copy of the provided name using strdup(). However, there is no detection on whether the name was previously set or not, so it is currently allowed to reuse the keyword multiple time to overwrite previous value, but here we forgot to free previous value for peers.name before assigning it to a new one. This should be backported to every stable versions. --- diff --git a/src/stick_table.c b/src/stick_table.c index 3f98d6e5d9..bee91130a7 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -995,6 +995,7 @@ int parse_stick_table(const char *file, int linenum, char **args, err_code |= ERR_ALERT | ERR_FATAL; goto out; } + ha_free(&t->peers.name); t->peers.name = strdup(args[idx++]); } else if (strcmp(args[idx], "expire") == 0) {