]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
bio_ssl.c: Do not call SSL_shutdown if not inited
authorerbsland-dev <github@erbsland.dev>
Sat, 22 Jun 2024 07:14:25 +0000 (09:14 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 25 Jun 2024 14:08:05 +0000 (16:08 +0200)
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 <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24705)

(cherry picked from commit 57b83edc46926662491d63666231ba7ddc954a38)

ssl/bio_ssl.c

index 401178f0c2e48c6a3719d0665fa10880e5cd1082..675255248b10df515d5a891e6674749eb57b822b 100644 (file)
@@ -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);