Abort on unrecognised warning alerts
authorMatt Caswell <matt@openssl.org>
Mon, 12 Sep 2016 10:04:51 +0000 (11:04 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 13 Sep 2016 10:53:54 +0000 (11:53 +0100)
A peer continually sending unrecognised warning alerts could mean that we
make no progress on a connection. We should abort rather than continuing if
we receive an unrecognised warning alert.

Thanks to Shi Lei for reporting this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 77a6be4dfc2ecf406c2559a99bea51317ce0f533)

ssl/record/rec_layer_s3.c

index 46870c054b82b9ba1ac2365bed6d1cb1d36e72cf..aa148ba490e55957f6c96fcc032e47d6b9220bb5 100644 (file)
@@ -1351,9 +1351,15 @@ int ssl3_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
                 goto f_err;
             }
 #ifdef SSL_AD_MISSING_SRP_USERNAME
-            else if (alert_descr == SSL_AD_MISSING_SRP_USERNAME)
-                return (0);
+            else if (alert_descr == SSL_AD_MISSING_SRP_USERNAME) {
+                return 0;
+            }
 #endif
+            else {
+                al = SSL_AD_HANDSHAKE_FAILURE;
+                SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNKNOWN_ALERT_TYPE);
+                goto f_err;
+            }
         } else if (alert_level == SSL3_AL_FATAL) {
             char tmp[16];