diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-07-16 18:21:58 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-07-16 18:21:58 +0000 |
commit | 0ee423f48e0dec4bc8db004d04b760b10c426d9a (patch) | |
tree | dc116a1e218faac41eaa1b3fc410c98728f0f152 /lib | |
parent | 333d5e9f0056c521b6566a504df8bdc61505a237 (diff) |
Enforce V_ASN1_OCTET_STRING type before accessing the object as octet string;
from OpenSSL (RT #3683)
ok doug@ jsing@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/asn1/p8_pkey.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libcrypto/asn1/p8_pkey.c b/lib/libcrypto/asn1/p8_pkey.c index e7edda714bd..2f7a469673b 100644 --- a/lib/libcrypto/asn1/p8_pkey.c +++ b/lib/libcrypto/asn1/p8_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p8_pkey.c,v 1.15 2015/02/11 04:00:39 jsing Exp $ */ +/* $OpenBSD: p8_pkey.c,v 1.16 2015/07/16 18:21:57 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -68,7 +68,9 @@ pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) /* 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 != NULL && + 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); } |