diff options
author | Rich Salz <rsalz@openssl.org> | 2017-02-16 11:13:47 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-03-07 09:56:49 -0500 |
commit | 9015d34e141af747f7c750f8d08f862b2a8273c7 (patch) | |
tree | e826853c944ba7775bb82c24f7ae8c664a5d3f97 /ssl/bio_ssl.c | |
parent | f8418d87e191e46b81e1b9548326ab2876fa0907 (diff) | |
download | openssl-9015d34e141af747f7c750f8d08f862b2a8273c7.tar.gz |
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)
Diffstat (limited to 'ssl/bio_ssl.c')
-rw-r--r-- | ssl/bio_ssl.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index 8b5036fe38..29ae258b35 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c @@ -506,12 +506,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); + } } |