]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: ssl/cli: fix ckch_conf leaks in "add ssl crt-list"
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 25 Nov 2026 17:04:37 +0000 (18:04 +0100)
committerOlivier Houchard <cognet@ci0.org>
Wed, 25 Nov 2026 16:51:43 +0000 (17:51 +0100)
On success, cli_parse_add_crtlist() leaks the strings of a ckch_conf in
two cases: when the store takes the conf parsed from the line, its
previous conf is overwritten without being freed, and when the store
already has instances, the parsed conf is only compared to the one of
the store and never freed.

Let's free the conf which is not used by the store. This was introduced
by commit 1bc6e990f ("MEDIUM: ssl/cli: handle crt-store keywords in
crt-list over the CLI") in 3.0-dev12, so this should be backported to
3.0, after commit 29225103f ("BUG/MEDIUM: ssl/cli: restore the store
conf on "add ssl crt-list" error").

src/ssl_crtlist.c

index a0399cb3eb542ea758f03a1aa6280f6ff5faf6d4..3b4499f7d122366b9a954d2d01eaf2a6fcb06353 100644 (file)
@@ -1462,6 +1462,9 @@ static int cli_parse_add_crtlist(char **args, char *payload, struct appctx *appc
        ctx->crtlist = crtlist;
        ctx->entry = entry;
 
+       /* the store uses only one of them */
+       ckch_conf_clean(adopted ? &old_cc : &cc);
+
        /* unlock is done in the release handler */
        return 0;