summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-03-15 11:51:48 +0000
committerMatt Caswell <matt@openssl.org>2016-03-18 11:59:11 +0000
commit4275ee389b4092363ed8f2f2fa8aa0240b0ea122 (patch)
tree9ffd4d831fd2458b3569042dbc7f90acd7df2d2a
parentd31b25138f26cad65182a325561f929d67806248 (diff)
Add a check for a failed malloc
Ensure we check for a NULL return from OPENSSL_malloc Issue reported by Guido Vranken. Reviewed-by: Richard Levitte <levitte@openssl.org>
-rw-r--r--ssl/d1_both.c2
-rw-r--r--ssl/t1_lib.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index aaa18677ce..19c3da6161 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -1579,6 +1579,8 @@ int dtls1_process_heartbeat(SSL *s)
* plus 2 bytes payload length, plus payload, plus padding
*/
buffer = OPENSSL_malloc(write_length);
+ if (buffer == NULL)
+ return -1;
bp = buffer;
/* Enter response type, length and copy payload */
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index 090f93ef62..0bdb77d49f 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -2581,6 +2581,8 @@ int tls1_process_heartbeat(SSL *s)
* plus 2 bytes payload length, plus payload, plus padding
*/
buffer = OPENSSL_malloc(1 + 2 + payload + padding);
+ if (buffer == NULL)
+ return -1;
bp = buffer;
/* Enter response type, length and copy payload */