Commit 4275ee38 authored by Matt Caswell's avatar Matt Caswell
Browse files

Add a check for a failed malloc



Ensure we check for a NULL return from OPENSSL_malloc

Issue reported by Guido Vranken.

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent d31b2513
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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 */
+2 −0
Original line number Diff line number Diff line
@@ -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 */