]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/ssl_old_test.c: Add check for OPENSSL_zalloc
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Tue, 14 Jun 2022 07:06:23 +0000 (15:06 +0800)
committerTodd Short <todd.short@me.com>
Wed, 15 Jun 2022 15:05:28 +0000 (11:05 -0400)
As the potential failure of the OPENSSL_zalloc(),
it should be better to add the check and return
error if fails.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/18552)

test/ssl_old_test.c

index 829f683a91b9de3c4a1b7d1972a721f68c746468..b011534220e4a21c69f726f6ffcf8a58c66e734c 100644 (file)
@@ -1741,6 +1741,8 @@ int main(int argc, char *argv[])
         /* Use a fixed key so that we can decrypt the ticket. */
         size = SSL_CTX_set_tlsext_ticket_keys(s_ctx, NULL, 0);
         keys = OPENSSL_zalloc(size);
+        if (keys == NULL)
+            goto end;
         SSL_CTX_set_tlsext_ticket_keys(s_ctx, keys, size);
         OPENSSL_free(keys);
     }