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>
This commit is contained in:
parent
3b93479fcf
commit
04d5242c46
@ -1459,6 +1459,8 @@ int dtls1_process_heartbeat(SSL *s)
|
|||||||
* plus 2 bytes payload length, plus payload, plus padding
|
* plus 2 bytes payload length, plus payload, plus padding
|
||||||
*/
|
*/
|
||||||
buffer = OPENSSL_malloc(write_length);
|
buffer = OPENSSL_malloc(write_length);
|
||||||
|
if (buffer == NULL)
|
||||||
|
return -1;
|
||||||
bp = buffer;
|
bp = buffer;
|
||||||
|
|
||||||
/* Enter response type, length and copy payload */
|
/* Enter response type, length and copy payload */
|
||||||
|
@ -3858,6 +3858,8 @@ int tls1_process_heartbeat(SSL *s)
|
|||||||
* plus 2 bytes payload length, plus payload, plus padding
|
* plus 2 bytes payload length, plus payload, plus padding
|
||||||
*/
|
*/
|
||||||
buffer = OPENSSL_malloc(1 + 2 + payload + padding);
|
buffer = OPENSSL_malloc(1 + 2 + payload + padding);
|
||||||
|
if (buffer == NULL)
|
||||||
|
return -1;
|
||||||
bp = buffer;
|
bp = buffer;
|
||||||
|
|
||||||
/* Enter response type, length and copy payload */
|
/* Enter response type, length and copy payload */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user