diff options
author | David Benjamin <davidben@google.com> | 2014-06-02 18:55:20 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2014-06-02 18:59:48 +0100 |
commit | 56b94a38b9a2197210a110c4a01a39ac75b34ce8 (patch) | |
tree | 62dc8844f8e5f36696ace7864edb0fd2d9420eec | |
parent | d52eb82781eff1f8245ae9c16c84db765f037cbe (diff) |
Check there is enough room for extension.
(cherry picked from commit 7d89b3bf42e4b4067371ab33ef7631434e41d1e4)
-rw-r--r-- | ssl/t1_lib.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 07674405d8..eefe93ed13 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -1380,6 +1380,8 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha #ifndef OPENSSL_NO_HEARTBEATS /* Add Heartbeat extension */ + if ((limit - ret - 4 - 1) < 0) + return NULL; s2n(TLSEXT_TYPE_heartbeat,ret); s2n(1,ret); /* Set mode: @@ -1658,6 +1660,8 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned cha /* Add Heartbeat extension if we've received one */ if (s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED) { + if ((limit - ret - 4 - 1) < 0) + return NULL; s2n(TLSEXT_TYPE_heartbeat,ret); s2n(1,ret); /* Set mode: |