diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2022-02-15 10:46:38 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-11-11 10:04:10 +0100 |
commit | 8095adc16b70b05a651b2c05cca64bda6e38f3fa (patch) | |
tree | 416838c84da06349154b9b8a2ed80ae15d112da7 /test | |
parent | 270c72a340c3f3524a00605d2e1905899d650276 (diff) |
test/helpers/handshake.c: Add check for OPENSSL_strdup
As the potential failure of the memory allocation, the OPENSSL_strdup()
could return NULL pointer and then be assigned to 'server_ctx'.
In order to tell the callers the failure of the configuration, it should
be better to return error.
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17705)
(cherry picked from commit 17da5f2af833ef16cc2e431359139a4a2e3775b9)
Diffstat (limited to 'test')
-rw-r--r-- | test/helpers/handshake.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/helpers/handshake.c b/test/helpers/handshake.c index 285391bc03..42f7aaf029 100644 --- a/test/helpers/handshake.c +++ b/test/helpers/handshake.c @@ -641,6 +641,8 @@ static int configure_handshake_ctx(SSL_CTX *server_ctx, SSL_CTX *server2_ctx, if (extra->server.session_ticket_app_data != NULL) { server_ctx_data->session_ticket_app_data = OPENSSL_strdup(extra->server.session_ticket_app_data); + if (!TEST_ptr(server_ctx_data->session_ticket_app_data)) + goto err; SSL_CTX_set_session_ticket_cb(server_ctx, generate_session_ticket_cb, decrypt_session_ticket_cb, server_ctx_data); } @@ -649,6 +651,8 @@ static int configure_handshake_ctx(SSL_CTX *server_ctx, SSL_CTX *server2_ctx, goto err; server2_ctx_data->session_ticket_app_data = OPENSSL_strdup(extra->server2.session_ticket_app_data); + if (!TEST_ptr(server2_ctx_data->session_ticket_app_data)) + goto err; SSL_CTX_set_session_ticket_cb(server2_ctx, NULL, decrypt_session_ticket_cb, server2_ctx_data); } |