0fca960
commit d30e582446b027868cdabd0994681643682045a4
0fca960
Author: Dr. Stephen Henson <steve@openssl.org>
0fca960
Date:   Fri May 16 13:00:45 2014 +0100
0fca960
0fca960
    Fix CVE-2014-0221
0fca960
    
0fca960
    Unnecessary recursion when receiving a DTLS hello request can be used to
0fca960
    crash a DTLS client. Fixed by handling DTLS hello request without recursion.
0fca960
    
0fca960
    Thanks to Imre Rad (Search-Lab Ltd.) for discovering this issue.
0fca960
0fca960
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
0fca960
index 07f67f8..4c2fd03 100644
0fca960
--- a/ssl/d1_both.c
0fca960
+++ b/ssl/d1_both.c
0fca960
@@ -793,6 +793,7 @@ dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok)
0fca960
 	int i,al;
0fca960
 	struct hm_header_st msg_hdr;
0fca960
 
0fca960
+	redo:
0fca960
 	/* see if we have the required fragment already */
0fca960
 	if ((frag_len = dtls1_retrieve_buffered_fragment(s,max,ok)) || *ok)
0fca960
 		{
0fca960
@@ -851,8 +852,7 @@ dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok)
0fca960
 					s->msg_callback_arg);
0fca960
 			
0fca960
 			s->init_num = 0;
0fca960
-			return dtls1_get_message_fragment(s, st1, stn,
0fca960
-				max, ok);
0fca960
+			goto redo;
0fca960
 			}
0fca960
 		else /* Incorrectly formated Hello request */
0fca960
 			{
0fca960