Skip to content

Commit

Permalink
Fix crash in dtls1_get_record whilst in the listen state where you ge…
Browse files Browse the repository at this point in the history
…t 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>
  • Loading branch information
snhenson authored and mattcaswell committed Jan 8, 2015
1 parent e078642 commit 8d7aab9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions ssl/d1_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,6 @@ int dtls1_get_record(SSL *s)
/* now s->packet_length == DTLS1_RT_HEADER_LENGTH */
i=rr->length;
n=ssl3_read_n(s,i,i,1);
if (n <= 0) return(n); /* error or non-blocking io */

/* this packet contained a partial record, dump it */
if ( n != i)
{
Expand Down
2 changes: 2 additions & 0 deletions ssl/s3_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ int ssl3_read_n(SSL *s, int n, int max, int extend)
* at once (as long as it fits into the buffer). */
if (SSL_version(s) == DTLS1_VERSION || SSL_version(s) == DTLS1_BAD_VER)
{
if (left == 0 && extend)
return 0;
if (left > 0 && n > left)
n = left;
}
Expand Down

0 comments on commit 8d7aab9

Please sign in to comment.