Follow on from CVE-2014-3571. This fixes the code that was the original source
authorMatt Caswell <matt@openssl.org>
Sat, 3 Jan 2015 00:54:35 +0000 (00:54 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 8 Jan 2015 15:49:27 +0000 (15:49 +0000)
of the crash due to p being NULL. Steve's fix prevents this situation from
occuring - however this is by no means obvious by looking at the code for
dtls1_get_record. This fix just makes things look a bit more sane.

Reviewed-by: Dr Stephen Henson <steve@openssl.org>
ssl/d1_pkt.c

index 9badc5e3f2d03a30c27b0c7b4d0f04f468412356..1028e41b562c510c2af4c14eecc21c3669c806ed 100644 (file)
@@ -679,7 +679,8 @@ again:
                 * would be dropped unnecessarily.
                 */
                if (!(s->d1->listen && rr->type == SSL3_RT_HANDSHAKE &&
-                   *p == SSL3_MT_CLIENT_HELLO) &&
+                   s->packet_length > DTLS1_RT_HEADER_LENGTH &&
+                   s->packet[DTLS1_RT_HEADER_LENGTH] == SSL3_MT_CLIENT_HELLO) &&
                    !dtls1_record_replay_check(s, bitmap))
                        {
                        rr->length = 0;