From: Shane Lontis Date: Tue, 11 Aug 2020 05:03:42 +0000 (+1000) Subject: Fix coverity CID #1465594 - Null dereference in EVP_PKEY_get0() X-Git-Tag: openssl-3.0.0-alpha7~511 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c1ccfea85e6dcb93aba5cfb166d7aa88bd0a587;p=thirdparty%2Fopenssl.git Fix coverity CID #1465594 - Null dereference in EVP_PKEY_get0() Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/12628) --- diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 7a798167880..503009dd931 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -720,6 +720,8 @@ int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) void *EVP_PKEY_get0(const EVP_PKEY *pkey) { + if (pkey == NULL) + return NULL; if (!evp_pkey_downgrade((EVP_PKEY *)pkey)) { ERR_raise(ERR_LIB_EVP, EVP_R_INACCESSIBLE_KEY); return NULL;