diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-06-12 11:27:28 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-06-15 14:23:21 +0200 |
commit | 9d9691f78a67fed1b30b0cf84b2f3601897b9639 (patch) | |
tree | 478797699f2c7e828ad1ae12895c8f47dbce7980 /crypto | |
parent | ASN1: rename asn1_par.c to asn1_parse.c for clarity; simplify asn1_parse2() (diff) | |
download | openssl-9d9691f78a67fed1b30b0cf84b2f3601897b9639.tar.xz openssl-9d9691f78a67fed1b30b0cf84b2f3601897b9639.zip |
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)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bio/bf_prefix.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/bio/bf_prefix.c b/crypto/bio/bf_prefix.c index 5727c14950..c9059ca80a 100644 --- a/crypto/bio/bf_prefix.c +++ b/crypto/bio/bf_prefix.c @@ -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) { |