aboutsummaryrefslogtreecommitdiff
path: root/ssl/record
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-05-23 21:32:12 +0100
committerMatt Caswell <matt@openssl.org>2015-05-25 17:48:41 +0100
commit02db21dfb4d9ea76d83a10df6d46d8b511fcce50 (patch)
tree14bd1e5246c73c86b26e6b1ddfb373b250fafcaf /ssl/record
parentfc0eb00bca9dd892592edb6367927186928a7e1a (diff)
downloadopenssl-02db21dfb4d9ea76d83a10df6d46d8b511fcce50.zip
openssl-02db21dfb4d9ea76d83a10df6d46d8b511fcce50.tar.gz
openssl-02db21dfb4d9ea76d83a10df6d46d8b511fcce50.tar.bz2
Don't send an alert if we've just received one
If the record received is for a version that we don't support, previously we were sending an alert back. However if the incoming record already looks like an alert then probably we shouldn't do that. So suppress an outgoing alert if it looks like we've got one incoming. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'ssl/record')
-rw-r--r--ssl/record/ssl3_record.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c
index 5070bc3..bae9490 100644
--- a/ssl/record/ssl3_record.c
+++ b/ssl/record/ssl3_record.c
@@ -268,11 +268,22 @@ int ssl3_get_record(SSL *s)
if (!s->first_packet && version != s->version) {
SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_WRONG_VERSION_NUMBER);
if ((s->version & 0xFF00) == (version & 0xFF00)
- && !s->enc_write_ctx && !s->write_hash)
+ && !s->enc_write_ctx && !s->write_hash) {
+ if (rr->type == SSL3_RT_ALERT) {
+ /*
+ * The record is using an incorrect version number, but
+ * what we've got appears to be an alert. We haven't
+ * read the body yet to check whether its a fatal or
+ * not - but chances are it is. We probably shouldn't
+ * send a fatal alert back. We'll just end.
+ */
+ goto err;
+ }
/*
* Send back error using their minor version number :-)
*/
s->version = (unsigned short)version;
+ }
al = SSL_AD_PROTOCOL_VERSION;
goto f_err;
}