diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-10-14 10:08:35 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-10-14 13:21:18 +0200 |
commit | 379d9fbe75b30013ba217d5478c9bf57e7ae459e (patch) | |
tree | 428e880fa7d949436a7c2e6d783d980a55541743 | |
parent | bd21292d235883e316a8f9fa1b58384576bf3a65 (diff) | |
download | gnutls-379d9fbe75b30013ba217d5478c9bf57e7ae459e.tar.gz |
record: disallow parsing of alert messages prior to session start
-rw-r--r-- | lib/gnutls_record.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c index c77787f91a..ef6fcd6523 100644 --- a/lib/gnutls_record.c +++ b/lib/gnutls_record.c @@ -775,6 +775,12 @@ record_add_to_buffers(gnutls_session_t session, gnutls_alert_get_name((int) bufel->msg. data[1])); + if (!session->internals.initial_negotiation_completed && + session->internals.handshake_in_progress && STATE == STATE0) { /* handshake hasn't started */ + ret = gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET); + goto unexpected_packet; + } + session->internals.last_alert = bufel->msg.data[1]; /* if close notify is received and @@ -791,7 +797,6 @@ record_add_to_buffers(gnutls_session_t session, /* if the alert is FATAL or WARNING * return the apropriate message */ - gnutls_assert(); ret = GNUTLS_E_WARNING_ALERT_RECEIVED; if (bufel->msg.data[0] == GNUTLS_AL_FATAL) { |