]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl/ckch: always free() the previous entry during parsing
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 9 May 2025 17:01:28 +0000 (19:01 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 9 May 2025 17:01:28 +0000 (19:01 +0200)
The ckch_conf_parse() function is the generic function which parses
crt-store keywords from the crt-store section, and also from a crt-list.

When having multiple time the same keyword, a leak of the previous value
happens. This patch ensure that the previous value is always freed
before overwriting it.

This patch should be backported as far as 3.0.

src/ssl_ckch.c

index ea60bd3f386681dab41d2b6d62c3720fb9dffcdd..cf1357168159b73b5654b79c21c51001067c9d37 100644 (file)
@@ -4870,6 +4870,7 @@ int ckch_conf_parse(char **args, int cur_arg, struct ckch_conf *f, int *found, c
                        if (ckch_conf_kws[i].type == PARSE_TYPE_STR) {
                                char **t = target;
 
+                               ha_free(t);
                                *t = strdup(args[cur_arg + 1]);
                                if (!*t) {
                                        ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);