File: 0109-Fix-crash-in-dtls1_get_record-whilst-in-the-listen-s.patch

package info (click to toggle)
openssl 1.0.1e-2%2Bdeb7u20
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 34,760 kB
  • sloc: ansic: 273,906; perl: 68,951; makefile: 13,201; asm: 9,007; cpp: 4,367; sh: 3,411; lisp: 24
file content (44 lines) | stat: -rw-r--r-- 1,296 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 8d7aab986b499f34d9e1bc58fbfd77f05c38116e Mon Sep 17 00:00:00 2001
From: "Dr. Stephen Henson" <steve@openssl.org>
Date: Sat, 3 Jan 2015 00:45:13 +0000
Subject: [PATCH 109/117] 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>
---
 ssl/d1_pkt.c | 2 --
 ssl/s3_pkt.c | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c
index edd17df..d717260 100644
--- a/ssl/d1_pkt.c
+++ b/ssl/d1_pkt.c
@@ -642,8 +642,6 @@ again:
 		/* 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)
 			{
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index d1cd752..1ec9e6e 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -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;
 		}
-- 
2.1.4