]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix coverity CID #1465594 - Null dereference in EVP_PKEY_get0()
authorShane Lontis <shane.lontis@oracle.com>
Tue, 11 Aug 2020 05:03:42 +0000 (15:03 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Mon, 24 Aug 2020 01:19:28 +0000 (11:19 +1000)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12628)

crypto/evp/p_lib.c

index 7a798167880ef1c78aa628e308fd1c034b1fa291..503009dd931e458d6160dbf99609aad7c690f6ad 100644 (file)
@@ -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;