PR: 2028
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de>
Approved by: steve@openssl.org

Fix DTLS cookie management bugs.
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index bd849ac..4d67892 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -1444,6 +1444,14 @@
 		return 1;
 	if (p >= limit)
 		return -1;
+	/* Skip past DTLS cookie */
+	if (s->version == DTLS1_VERSION || s->version == DTLS1_BAD_VER)
+		{
+		i = *(p++);
+		p+= i;
+		if (p >= limit)
+			return -1;
+		}
 	/* Skip past cipher list */
 	n2s(p, i);
 	p+= i;