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.1.7~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c94b641cca452f6d36d796d91c9487453fec8db7;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 401178f0c2e..675255248b1 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c @@ -77,7 +77,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);