From 3c1ccfea85e6dcb93aba5cfb166d7aa88bd0a587 Mon Sep 17 00:00:00 2001 From: Shane Lontis Date: Tue, 11 Aug 2020 15:03:42 +1000 Subject: [PATCH] Fix coverity CID #1465594 - Null dereference in EVP_PKEY_get0() Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/12628) --- crypto/evp/p_lib.c | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.47.2