]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl/cli: fix a potential NULL dereference
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 20 Mar 2020 13:42:36 +0000 (14:42 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 20 Mar 2020 13:49:25 +0000 (14:49 +0100)
Fix a potential NULL dereference in "show ssl cert" when we can't
allocate the <out> trash buffer.

This patch creates a new label so we could jump without trying to do the
ci_putchk in this case.

This bug was introduced by ea987ed ("MINOR: ssl/cli: 'new ssl cert'
command"). 2.2 only.

This bug was referenced by issue #556.

src/ssl_sock.c

index bf571dd8a1addce90099fd6ec3df4791bf16a636..9b44e9d0b91b8b3d55ad36f5ae28ed2e3c692f38 100644 (file)
@@ -11249,7 +11249,7 @@ static int cli_io_handler_show_cert_detail(struct appctx *appctx)
        int i;
 
        if (!tmp || !out)
-               goto end;
+               goto end_no_putchk;
 
        if (!ckchs->multi) {
                chunk_appendf(out, "Filename: ");
@@ -11374,6 +11374,7 @@ end:
                goto yield;
        }
 
+end_no_putchk:
        if (bio)
                BIO_free(bio);
        free_trash_chunk(tmp);