]> git.ipfire.org Git - thirdparty/openssl.git/commit
BIO_new_from_core_bio: Check for NULL pointer after calling get_globals
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Tue, 25 Jan 2022 03:05:13 +0000 (11:05 +0800)
committerTomas Mraz <tomas@openssl.org>
Thu, 27 Jan 2022 16:46:19 +0000 (17:46 +0100)
commit7f1cb465c1f0e45bde8c1ee54a37e6f7641c70c6
tree85470a4d10f20be1f8b1e3e685471b65a9beb0c0
parent4ed381736b063284bdbd5d302988617aa4366a3f
BIO_new_from_core_bio: Check for NULL pointer after calling get_globals

The get_globals could return NULL, for example,
CRYPTO_THREAD_read_lock() failed.
Therefore, just checking the member of 'bcgbl' is not enough.
We need to check 'bcgbl' itself too in order to avoid the dereference of
the NULL pointer.
And the caller of ossl_bio_init_core(), OSSL_LIB_CTX_new_from_dispatch()
in `crypto/context.c`, has already checked return value and dealed with
the situation if it returns 0.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17581)
crypto/bio/bss_core.c