[openssl-commits] [openssl] OpenSSL_1_0_1-stable update

Emilia Kasper emilia at openssl.org
Thu Sep 10 15:24:18 UTC 2015


The branch OpenSSL_1_0_1-stable has been updated
       via  4cb23e12a300b64dd997ca00cee75cde8925df05 (commit)
      from  dd642deea83d0f5b4accee9855e36c36699653cc (commit)


- Log -----------------------------------------------------------------
commit 4cb23e12a300b64dd997ca00cee75cde8925df05
Author: Emilia Kasper <emilia at openssl.org>
Date:   Tue Sep 1 16:31:55 2015 +0200

    RT3754: check for NULL pointer
    
    Fix both the caller to error out on malloc failure, as well as the
    eventual callee to handle a NULL gracefully.
    
    Reviewed-by: Viktor Dukhovni <viktor at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/evp/p_lib.c    | 2 +-
 crypto/evp/pmeth_gn.c | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index 2b84dc7..375f561 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -253,7 +253,7 @@ int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len)
 
 int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
 {
-    if (!EVP_PKEY_set_type(pkey, type))
+    if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))
         return 0;
     pkey->pkey.ptr = key;
     return (key != NULL);
diff --git a/crypto/evp/pmeth_gn.c b/crypto/evp/pmeth_gn.c
index 59f8134..6435f1b 100644
--- a/crypto/evp/pmeth_gn.c
+++ b/crypto/evp/pmeth_gn.c
@@ -96,12 +96,17 @@ int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey)
         return -1;
     }
 
-    if (!ppkey)
+    if (ppkey == NULL)
         return -1;
 
-    if (!*ppkey)
+    if (*ppkey == NULL)
         *ppkey = EVP_PKEY_new();
 
+    if (*ppkey == NULL) {
+        EVPerr(EVP_F_EVP_PKEY_PARAMGEN, ERR_R_MALLOC_FAILURE);
+        return -1;
+    }
+
     ret = ctx->pmeth->paramgen(ctx, *ppkey);
     if (ret <= 0) {
         EVP_PKEY_free(*ppkey);


More information about the openssl-commits mailing list