diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2022-02-21 10:54:29 +0800 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-02-23 10:22:06 +1100 |
commit | 46119286c16341734b3cb60945fb07d1ea30eb81 (patch) | |
tree | 5ff47c2564460d18b47413f6cb5fce32b8e7ca20 /test | |
parent | ad910cc482c8e06d04a141a9f5f79172a6e56f66 (diff) |
test/sslapitest.c: Add check for SSL_CTX_new
As the potential failure of the memory allocation, it should
be better to check the return value of SSL_CTX_new() and return
error if fails, like SSL_CTX_new_ex().
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17739)
(cherry picked from commit b0317df2311769e02d9ceb4e7afe19521f8ffbf1)
Diffstat (limited to 'test')
-rw-r--r-- | test/sslapitest.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/sslapitest.c b/test/sslapitest.c index 9056fa28f1..b2f3471548 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -8074,8 +8074,12 @@ static int test_cert_cb_int(int prot, int tst) else cert_cb_cnt = 0; - if (tst == 2) + if (tst == 2) { snictx = SSL_CTX_new(TLS_server_method()); + if (!TEST_ptr(snictx)) + goto end; + } + SSL_CTX_set_cert_cb(sctx, cert_cb, snictx); if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, |