summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2017-02-16 11:13:47 -0500
committerRich Salz <rsalz@openssl.org>2017-03-07 10:05:08 -0500
commit51800912006b2b09ed61607842fce8dbb2f44a9c (patch)
treef459f1dd5702a1a2fd472831ff8a6b4de078b34c /ssl
parentc6e4fdbf8b44010ba12b72d519e437bbd2da71e6 (diff)
Get pointer type right in BIO_ssl_shutdown()
Also, restore 1.0.2 behavior of looping over all BIO's in the chain. Thanks to Joseph Bester for finding this and suggesting a fix to the crash. Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2651) (cherry picked from commit 9015d34e141af747f7c750f8d08f862b2a8273c7)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/bio_ssl.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c
index 3dd09cf52d..5322c03646 100644
--- a/ssl/bio_ssl.c
+++ b/ssl/bio_ssl.c
@@ -517,12 +517,13 @@ int BIO_ssl_copy_session_id(BIO *t, BIO *f)
void BIO_ssl_shutdown(BIO *b)
{
- SSL *s;
-
- b = BIO_find_type(b, BIO_TYPE_SSL);
- if (b == NULL)
- return;
-
- s = BIO_get_data(b);
- SSL_shutdown(s);
+ BIO_SSL *bdata;
+
+ for (; b != NULL; b = BIO_next(b)) {
+ if (BIO_method_type(b) != BIO_TYPE_SSL)
+ continue;
+ bdata = BIO_get_data(b);
+ if (bdata != NULL && bdata->ssl != NULL)
+ SSL_shutdown(bdata->ssl);
+ }
}