summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortedu <>2014-07-10 12:24:25 +0000
committertedu <>2014-07-10 12:24:25 +0000
commitaf5801cef5d1cd3e1d06ac740c6ddd3aac4e7d8f (patch)
treedb7b38cb9e1e6986e22954bebefd5e5f7c631825 /src
parentf374a6c7fcebd44c8a8966ae1135bd8cb53e3702 (diff)
downloadopenbsd-af5801cef5d1cd3e1d06ac740c6ddd3aac4e7d8f.tar.gz
openbsd-af5801cef5d1cd3e1d06ac740c6ddd3aac4e7d8f.tar.bz2
openbsd-af5801cef5d1cd3e1d06ac740c6ddd3aac4e7d8f.zip
make asn1 free safe to call with null pointers of any type.
ok jsing miod
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/asn1/tasn_fre.c7
-rw-r--r--src/lib/libssl/src/crypto/asn1/tasn_fre.c7
2 files changed, 6 insertions, 8 deletions
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 @@
1/* $OpenBSD: tasn_fre.c,v 1.11 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: tasn_fre.c,v 1.12 2014/07/10 12:24:25 tedu Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -89,10 +89,9 @@ asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
89 ASN1_aux_cb *asn1_cb; 89 ASN1_aux_cb *asn1_cb;
90 int i; 90 int i;
91 91
92 if (!pval) 92 if (pval == NULL || *pval == NULL)
93 return;
94 if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval)
95 return; 93 return;
94
96 if (aux && aux->asn1_cb) 95 if (aux && aux->asn1_cb)
97 asn1_cb = aux->asn1_cb; 96 asn1_cb = aux->asn1_cb;
98 else 97 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 @@
1/* $OpenBSD: tasn_fre.c,v 1.11 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: tasn_fre.c,v 1.12 2014/07/10 12:24:25 tedu Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -89,10 +89,9 @@ asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
89 ASN1_aux_cb *asn1_cb; 89 ASN1_aux_cb *asn1_cb;
90 int i; 90 int i;
91 91
92 if (!pval) 92 if (pval == NULL || *pval == NULL)
93 return;
94 if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval)
95 return; 93 return;
94
96 if (aux && aux->asn1_cb) 95 if (aux && aux->asn1_cb)
97 asn1_cb = aux->asn1_cb; 96 asn1_cb = aux->asn1_cb;
98 else 97 else