EVP p_lib: Add NULL check to EVP_PKEY_missing_parameters.
authorPauli <paul.dale@oracle.com>
Wed, 20 Nov 2019 03:14:39 +0000 (13:14 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 21 Nov 2019 04:34:55 +0000 (14:34 +1000)
Check for NULL and return error if so.
This can possibly be called from apps/ca.c with a NULL argument.

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/10474)

crypto/evp/p_lib.c

index 0e93786c82a78e45152e7f1d5f1c1514593611db..759fb9540102d674e60894aee1e51558bcfe3ea0 100644 (file)
@@ -105,7 +105,7 @@ int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
 
 int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey)
 {
-    if (pkey->ameth && pkey->ameth->param_missing)
+    if (pkey != NULL && pkey->ameth && pkey->ameth->param_missing)
         return pkey->ameth->param_missing(pkey);
     return 0;
 }