RT3301: Discard too-long heartbeat requests

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit af4c6e348e4bad6303e7d214cdcf2536487aabe4)
This commit is contained in:
Erik Auerswald 2014-08-26 22:50:34 -04:00 committed by Rich Salz
parent 61a44b76a0
commit ff89be854e

View File

@ -1363,6 +1363,9 @@ dtls1_process_heartbeat(SSL *s)
/* Read type and payload length first */ /* Read type and payload length first */
if (1 + 2 + 16 > s->s3->rrec.length) if (1 + 2 + 16 > s->s3->rrec.length)
return 0; /* silently discard */ return 0; /* silently discard */
if (s->s3->rrec.length > SSL3_RT_MAX_PLAIN_LENGTH)
return 0; /* silently discard per RFC 6520 sec. 4 */
hbtype = *p++; hbtype = *p++;
n2s(p, payload); n2s(p, payload);
if (1 + 2 + payload + 16 > s->s3->rrec.length) if (1 + 2 + payload + 16 > s->s3->rrec.length)