Blame SOURCES/openssl-1.0.1e-cve-2014-3571.patch

78ef1d
diff -up openssl-1.0.1e/ssl/d1_pkt.c.dtls1-reads openssl-1.0.1e/ssl/d1_pkt.c
78ef1d
--- openssl-1.0.1e/ssl/d1_pkt.c.dtls1-reads	2015-01-12 17:31:41.647213706 +0100
78ef1d
+++ openssl-1.0.1e/ssl/d1_pkt.c	2015-01-12 17:38:21.708261411 +0100
78ef1d
@@ -641,8 +641,6 @@ again:
78ef1d
 		/* now s->packet_length == DTLS1_RT_HEADER_LENGTH */
78ef1d
 		i=rr->length;
78ef1d
 		n=ssl3_read_n(s,i,i,1);
78ef1d
-		if (n <= 0) return(n); /* error or non-blocking io */
78ef1d
-
78ef1d
 		/* this packet contained a partial record, dump it */
78ef1d
 		if ( n != i)
78ef1d
 			{
78ef1d
@@ -677,7 +675,8 @@ again:
78ef1d
 		 * would be dropped unnecessarily.
78ef1d
 		 */
78ef1d
 		if (!(s->d1->listen && rr->type == SSL3_RT_HANDSHAKE &&
78ef1d
-		    *p == SSL3_MT_CLIENT_HELLO) &&
78ef1d
+		    s->packet_length > DTLS1_RT_HEADER_LENGTH &&
78ef1d
+		    s->packet[DTLS1_RT_HEADER_LENGTH] == SSL3_MT_CLIENT_HELLO) &&
78ef1d
 		    !dtls1_record_replay_check(s, bitmap))
78ef1d
 			{
78ef1d
 			rr->length = 0;
78ef1d
diff -up openssl-1.0.1e/ssl/s3_pkt.c.dtls1-reads openssl-1.0.1e/ssl/s3_pkt.c
78ef1d
--- openssl-1.0.1e/ssl/s3_pkt.c.dtls1-reads	2015-01-12 17:31:41.680214453 +0100
78ef1d
+++ openssl-1.0.1e/ssl/s3_pkt.c	2015-01-12 17:38:06.721922482 +0100
78ef1d
@@ -182,6 +182,8 @@ int ssl3_read_n(SSL *s, int n, int max,
78ef1d
 	 * at once (as long as it fits into the buffer). */
78ef1d
 	if (SSL_version(s) == DTLS1_VERSION || SSL_version(s) == DTLS1_BAD_VER)
78ef1d
 		{
78ef1d
+		if (left == 0 && extend)
78ef1d
+			return 0;
78ef1d
 		if (left > 0 && n > left)
78ef1d
 			n = left;
78ef1d
 		}