summaryrefslogtreecommitdiffstats
path: root/ssl/d1_both.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2011-10-27 13:06:43 +0000
committerDr. Stephen Henson <steve@openssl.org>2011-10-27 13:06:43 +0000
commit5372f5f989b232ae61472c5217214272c7ab42fe (patch)
treef18b55f40214007c18c3ecfe78f2ff77cf95340b /ssl/d1_both.c
parent6d24c09a6963d6a77fc5695c3800da72de3432e4 (diff)
PR: 2628
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve Send alert instead of assertion failure for incorrectly formatted DTLS fragments.
Diffstat (limited to 'ssl/d1_both.c')
-rw-r--r--ssl/d1_both.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index 68172a9dda..9f898d6997 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -793,7 +793,13 @@ dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok)
*ok = 0;
return i;
}
- OPENSSL_assert(i == DTLS1_HM_HEADER_LENGTH);
+ /* Handshake fails if message header is incomplete */
+ if (i != DTLS1_HM_HEADER_LENGTH)
+ {
+ al=SSL_AD_UNEXPECTED_MESSAGE;
+ SSLerr(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT,SSL_R_UNEXPECTED_MESSAGE);
+ goto f_err;
+ }
/* parse the message fragment header */
dtls1_get_message_header(wire, &msg_hdr);
@@ -865,7 +871,12 @@ dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok)
/* XDTLS: an incorrectly formatted fragment should cause the
* handshake to fail */
- OPENSSL_assert(i == (int)frag_len);
+ if (i != (int)frag_len)
+ {
+ al=SSL3_AD_ILLEGAL_PARAMETER;
+ SSLerr(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT,SSL3_AD_ILLEGAL_PARAMETER);
+ goto f_err;
+ }
*ok = 1;