From: Dr. Stephen Henson Date: Sun, 1 Feb 2015 13:06:32 +0000 (+0000) Subject: Check PKCS#8 pkey field is valid before cleansing. X-Git-Tag: OpenSSL_0_9_8zf~23 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d64a227f1f433cd754baee4065127d28723237ff;p=oweals%2Fopenssl.git Check PKCS#8 pkey field is valid before cleansing. PR:3683 Reviewed-by: Tim Hudson (cherry picked from commit 52e028b9de371da62c1e51b46592517b1068d770) --- diff --git a/crypto/asn1/p8_pkey.c b/crypto/asn1/p8_pkey.c index d8fc07bc0b..6cd36ce860 100644 --- a/crypto/asn1/p8_pkey.c +++ b/crypto/asn1/p8_pkey.c @@ -68,7 +68,8 @@ static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) /* Since the structure must still be valid use ASN1_OP_FREE_PRE */ if (operation == ASN1_OP_FREE_PRE) { PKCS8_PRIV_KEY_INFO *key = (PKCS8_PRIV_KEY_INFO *)*pval; - if (key->pkey->value.octet_string) + if (key->pkey && key->pkey->type == V_ASN1_OCTET_STRING + && key->pkey->value.octet_string != NULL) OPENSSL_cleanse(key->pkey->value.octet_string->data, key->pkey->value.octet_string->length); }