diff options
author | Matt Caswell <matt@openssl.org> | 2015-01-30 17:29:41 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-03-26 13:53:07 +0000 |
commit | 258f8721a5d2c3ec5fd433e89112885139be1db3 (patch) | |
tree | e43ce47ce54ae67d4a50f28306fdde89f5f5241d /ssl/d1_both.c | |
parent | ab97b2cd4301074fd88fd2f13b8c79342593dae4 (diff) |
Encapsulate s->s3->rrec
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'ssl/d1_both.c')
-rw-r--r-- | ssl/d1_both.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c index 8d15f70a4f..48c75b2227 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c @@ -1349,25 +1349,28 @@ int dtls1_shutdown(SSL *s) #ifndef OPENSSL_NO_HEARTBEATS int dtls1_process_heartbeat(SSL *s) { - unsigned char *p = &s->s3->rrec.data[0], *pl; + unsigned char *p, *pl; unsigned short hbtype; unsigned int payload; unsigned int padding = 16; /* Use minimum padding */ + unsigned int length; + + p = SSL3_RECORD_get_data(RECORD_LAYER_get_rrec(&s->rlayer)); + length = SSL3_RECORD_get_length(RECORD_LAYER_get_rrec(&s->rlayer)); if (s->msg_callback) s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT, - &s->s3->rrec.data[0], s->s3->rrec.length, - s, s->msg_callback_arg); + p, length, s, s->msg_callback_arg); /* Read type and payload length first */ - if (1 + 2 + 16 > s->s3->rrec.length) + if (1 + 2 + 16 > length) return 0; /* silently discard */ - if (s->s3->rrec.length > SSL3_RT_MAX_PLAIN_LENGTH) + if (length > SSL3_RT_MAX_PLAIN_LENGTH) return 0; /* silently discard per RFC 6520 sec. 4 */ hbtype = *p++; n2s(p, payload); - if (1 + 2 + payload + 16 > s->s3->rrec.length) + if (1 + 2 + payload + 16 > length) return 0; /* silently discard per RFC 6520 sec. 4 */ pl = p; |