summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordoug <>2015-04-25 16:02:55 +0000
committerdoug <>2015-04-25 16:02:55 +0000
commitdb89ec62c9654a4fdabda5759955699428c4fbf2 (patch)
tree405ed783645d9fd2f2e2633f414dad4c46663610 /src
parent14b4339c31e6165fb11bbb889e4b24b201ac5e29 (diff)
downloadopenbsd-db89ec62c9654a4fdabda5759955699428c4fbf2.tar.gz
openbsd-db89ec62c9654a4fdabda5759955699428c4fbf2.tar.bz2
openbsd-db89ec62c9654a4fdabda5759955699428c4fbf2.zip
Don't ignore the reference count in X509_STORE_free.
Based on this upstream commit: bff9ce4db38b297c72a6d84617d71ae2934450f7 which didn't make it into a release until 1.0.2. Thanks to william at 25thandclement dot com for reporting this! ok deraadt@ jsing@ beck@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/x509/x509_lu.c6
-rw-r--r--src/lib/libssl/src/crypto/x509/x509_lu.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c
index e8151b774a..fdb10023be 100644
--- a/src/lib/libcrypto/x509/x509_lu.c
+++ b/src/lib/libcrypto/x509/x509_lu.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_lu.c,v 1.19 2015/02/10 11:22:21 jsing Exp $ */ 1/* $OpenBSD: x509_lu.c,v 1.20 2015/04/25 16:02:55 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -254,6 +254,10 @@ X509_STORE_free(X509_STORE *vfy)
254 if (vfy == NULL) 254 if (vfy == NULL)
255 return; 255 return;
256 256
257 i = CRYPTO_add(&vfy->references, -1, CRYPTO_LOCK_X509_STORE);
258 if (i > 0)
259 return;
260
257 sk = vfy->get_cert_methods; 261 sk = vfy->get_cert_methods;
258 for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) { 262 for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
259 lu = sk_X509_LOOKUP_value(sk, i); 263 lu = sk_X509_LOOKUP_value(sk, i);
diff --git a/src/lib/libssl/src/crypto/x509/x509_lu.c b/src/lib/libssl/src/crypto/x509/x509_lu.c
index e8151b774a..fdb10023be 100644
--- a/src/lib/libssl/src/crypto/x509/x509_lu.c
+++ b/src/lib/libssl/src/crypto/x509/x509_lu.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_lu.c,v 1.19 2015/02/10 11:22:21 jsing Exp $ */ 1/* $OpenBSD: x509_lu.c,v 1.20 2015/04/25 16:02:55 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -254,6 +254,10 @@ X509_STORE_free(X509_STORE *vfy)
254 if (vfy == NULL) 254 if (vfy == NULL)
255 return; 255 return;
256 256
257 i = CRYPTO_add(&vfy->references, -1, CRYPTO_LOCK_X509_STORE);
258 if (i > 0)
259 return;
260
257 sk = vfy->get_cert_methods; 261 sk = vfy->get_cert_methods;
258 for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) { 262 for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
259 lu = sk_X509_LOOKUP_value(sk, i); 263 lu = sk_X509_LOOKUP_value(sk, i);