From af5801cef5d1cd3e1d06ac740c6ddd3aac4e7d8f Mon Sep 17 00:00:00 2001 From: tedu <> Date: Thu, 10 Jul 2014 12:24:25 +0000 Subject: make asn1 free safe to call with null pointers of any type. ok jsing miod --- src/lib/libcrypto/asn1/tasn_fre.c | 7 +++---- src/lib/libssl/src/crypto/asn1/tasn_fre.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/asn1/tasn_fre.c b/src/lib/libcrypto/asn1/tasn_fre.c index 0369bf2339..d8d55a536c 100644 --- a/src/lib/libcrypto/asn1/tasn_fre.c +++ b/src/lib/libcrypto/asn1/tasn_fre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_fre.c,v 1.11 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: tasn_fre.c,v 1.12 2014/07/10 12:24:25 tedu Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -89,10 +89,9 @@ asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine) ASN1_aux_cb *asn1_cb; int i; - if (!pval) - return; - if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) + if (pval == NULL || *pval == NULL) return; + if (aux && aux->asn1_cb) asn1_cb = aux->asn1_cb; else diff --git a/src/lib/libssl/src/crypto/asn1/tasn_fre.c b/src/lib/libssl/src/crypto/asn1/tasn_fre.c index 0369bf2339..d8d55a536c 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_fre.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_fre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_fre.c,v 1.11 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: tasn_fre.c,v 1.12 2014/07/10 12:24:25 tedu Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -89,10 +89,9 @@ asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine) ASN1_aux_cb *asn1_cb; int i; - if (!pval) - return; - if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) + if (pval == NULL || *pval == NULL) return; + if (aux && aux->asn1_cb) asn1_cb = aux->asn1_cb; else -- cgit v1.2.3-55-g6feb