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 11:00:07 +0000 (12:00 +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>
ssl/s3_pkt.c

index df124cf52caf019f665a4f794196a8fe4fe32c5b..91f0c58fb2c4bb49916a6bc4418fb6aed17ce4d9 100644 (file)
@@ -1462,8 +1462,13 @@ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
             }
 #ifdef SSL_AD_MISSING_SRP_USERNAME
             else if (alert_descr == SSL_AD_MISSING_SRP_USERNAME)
-                return (0);
+                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];