]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stktable: missing free in parse_stick_table()
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 2 Nov 2023 08:18:55 +0000 (09:18 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Nov 2023 16:30:30 +0000 (17:30 +0100)
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.

src/stick_table.c

index 3f98d6e5d96b2afb04197ab62d39f658a12f045f..bee91130a787f6ac0a227314db40c9924dd3a66f 100644 (file)
@@ -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) {