summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2014-06-02 19:55:20 +0200
committerDr. Stephen Henson <steve@openssl.org>2014-06-03 00:55:56 +0200
commitc7f267397e9f1f8b43ddc84c4268bccc27d52b04 (patch)
tree3c3592d7f116506bc2817b064551468e3870fd53 /ssl
parentFree up s->d1->buffered_app_data.q properly. (diff)
downloadopenssl-c7f267397e9f1f8b43ddc84c4268bccc27d52b04.tar.xz
openssl-c7f267397e9f1f8b43ddc84c4268bccc27d52b04.zip
Check there is enough room for extension.
Diffstat (limited to 'ssl')
-rw-r--r--ssl/t1_lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index c4e27b972b..cf007f9cce 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -1416,6 +1416,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:
@@ -1698,6 +1700,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: