From: erbsland-dev Date: Sat, 22 Jun 2024 07:14:25 +0000 (+0200) Subject: bio_ssl.c: Do not call SSL_shutdown if not inited X-Git-Tag: openssl-3.3.2~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db4ebf84c02b4ca08f450d83190cdf584785d43a;p=thirdparty%2Fopenssl.git bio_ssl.c: Do not call SSL_shutdown if not inited Fixes #4545 If free is called for an SSL BIO that is in initialization phase, the `SSL_shutdown` call is omitted. Reviewed-by: Neil Horman Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/24705) (cherry picked from commit 57b83edc46926662491d63666231ba7ddc954a38) --- diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index aabd047fe58..ac65a3988bd 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c @@ -79,7 +79,7 @@ static int ssl_free(BIO *a) return 0; bs = BIO_get_data(a); if (BIO_get_shutdown(a)) { - if (bs->ssl != NULL) + if (bs->ssl != NULL && !SSL_in_init(bs->ssl)) SSL_shutdown(bs->ssl); if (BIO_get_init(a)) SSL_free(bs->ssl);