RT3061: slightly amend patch
authorEmilia Kasper <emilia@openssl.org>
Fri, 22 Aug 2014 13:16:00 +0000 (15:16 +0200)
committerEmilia Kasper <emilia@openssl.org>
Fri, 22 Aug 2014 13:23:33 +0000 (15:23 +0200)
Add an extra NULL dereference check

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
crypto/dsa/dsa_ameth.c

index aa3f55e..50273b0 100644 (file)
@@ -307,7 +307,7 @@ static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
        unsigned char *dp = NULL;
        int dplen;
 
-       if (!pkey->pkey.dsa->priv_key)
+       if (!pkey->pkey.dsa || !pkey->pkey.dsa->priv_key)
                {
                DSAerr(DSA_F_DSA_PRIV_ENCODE,DSA_R_MISSING_PARAMETERS);
                goto err;
@@ -717,4 +717,3 @@ const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] =
                old_dsa_priv_encode
                }
        };
-