BIO: prevent crash on NULL BIO for prefix_ctrl() and thus for BIO_set_prefix(), BIO_set_indent(), etc.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15722)
master
Dr. David von Oheimb 2 years ago committed by Dr. David von Oheimb
parent 4439a6483e
commit 9d9691f78a

@ -151,9 +151,9 @@ static int prefix_write(BIO *b, const char *out, size_t outl,
static long prefix_ctrl(BIO *b, int cmd, long num, void *ptr)
{
long ret = 0;
PREFIX_CTX *ctx = BIO_get_data(b);
PREFIX_CTX *ctx;
if (ctx == NULL)
if (b == NULL || (ctx = BIO_get_data(b)) == NULL)
return -1;
switch (cmd) {

Loading…
Cancel
Save