diff options
author | Matt Caswell <matt@openssl.org> | 2016-03-15 11:51:48 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-03-18 11:56:34 +0000 |
commit | 04d5242c46b0f348f5ab92e9764f138547b237c5 (patch) | |
tree | a84e567ab0b72f7455239e9f68c1d5b612181e12 | |
parent | 3b93479fcfd335622bb9e5e8cc08acd328750f44 (diff) | |
download | openssl-new-04d5242c46b0f348f5ab92e9764f138547b237c5.tar.gz |
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.c | 2 | ||||
-rw-r--r-- | ssl/t1_lib.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c index d1fc716d5c..5d26c94926 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c @@ -1459,6 +1459,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 0e7a262a0d..0bf0ea5363 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -3858,6 +3858,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 */ |