BUG/MINOR: ssl/cli: fix a potential NULL dereference

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.
This commit is contained in:
William Lallemand 2020-03-20 14:42:36 +01:00 committed by William Lallemand
parent c0caac2cc8
commit 18eeb8e815

View File

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