Avoid sending alerts after shutdown
authorDmitry Belyavskiy <beldmit@gmail.com>
Wed, 5 May 2021 12:29:28 +0000 (14:29 +0200)
committerDmitry Belyavskiy <beldmit@gmail.com>
Thu, 6 May 2021 15:11:20 +0000 (17:11 +0200)
Fixes #11388

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15159)

(cherry picked from commit 22d1138fe2fde9a16e80b81de1d848ae6fa879ef)

ssl/s3_msg.c

index 339fb2774a63391cd4c522cc9299b5eaaa41e4c0..721bbb73207403f9fbab2e56c600f034ed38b93c 100644 (file)
@@ -48,6 +48,8 @@ int ssl3_send_alert(SSL *s, int level, int desc)
                                           * protocol_version alerts */
     if (desc < 0)
         return -1;
+    if (s->shutdown & SSL_SENT_SHUTDOWN && desc != SSL_AD_CLOSE_NOTIFY)
+        return -1;
     /* If a fatal one, remove from cache */
     if ((level == SSL3_AL_FATAL) && (s->session != NULL))
         SSL_CTX_remove_session(s->session_ctx, s->session);