Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de>

Fix padding bugs in Heartbeat support.
This commit is contained in:
Dr. Stephen Henson 2012-02-27 16:38:24 +00:00
parent d441e6d8db
commit 57cb030cea
2 changed files with 6 additions and 2 deletions

View File

@ -1422,8 +1422,9 @@ dtls1_process_heartbeat(SSL *s)
*bp++ = TLS1_HB_RESPONSE;
s2n(payload, bp);
memcpy(bp, pl, payload);
bp += payload;
/* Random padding */
RAND_pseudo_bytes(p, padding);
RAND_pseudo_bytes(bp, padding);
r = dtls1_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding);

View File

@ -2467,7 +2467,10 @@ tls1_process_heartbeat(SSL *s)
*bp++ = TLS1_HB_RESPONSE;
s2n(payload, bp);
memcpy(bp, pl, payload);
bp += payload;
/* Random padding */
RAND_pseudo_bytes(bp, padding);
r = ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding);
if (r >= 0 && s->msg_callback)