Skip to content

Commit feba02f

Browse files
snhensonmattcaswell
authored andcommitted
Fix crash in dtls1_get_record whilst in the listen state where you get two
separate reads performed - one for the header and one for the body of the handshake record. CVE-2014-3571 Reviewed-by: Matt Caswell <matt@openssl.org>
1 parent 4a4d415 commit feba02f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: ssl/d1_pkt.c

-2
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,6 @@ int dtls1_get_record(SSL *s)
645645
/* now s->packet_length == DTLS1_RT_HEADER_LENGTH */
646646
i=rr->length;
647647
n=ssl3_read_n(s,i,i,1);
648-
if (n <= 0) return(n); /* error or non-blocking io */
649-
650648
/* this packet contained a partial record, dump it */
651649
if ( n != i)
652650
{

Diff for: ssl/s3_pkt.c

+2
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ int ssl3_read_n(SSL *s, int n, int max, int extend)
197197
* at once (as long as it fits into the buffer). */
198198
if (SSL_IS_DTLS(s))
199199
{
200+
if (left == 0 && extend)
201+
return 0;
200202
if (left > 0 && n > left)
201203
n = left;
202204
}

0 commit comments

Comments
 (0)