diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2022-01-24 11:18:38 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-01-25 18:15:22 +0100 |
commit | 7625d70ad9e7be0588dd9453e89892c2b24b8175 (patch) | |
tree | 0196501ad8b2d0137861ed04b8ac199529c61602 /test | |
parent | 2208ba56ebefe4cf7d924e2ac7044ccd3307250b (diff) |
test/ct_test.c: Add the missing check after calling sk_SCT_new_null
As the potential failure of the allocation, the sk_SCT_new_null() could
return NULL pointer if fails.
And then sk_SCT_push() uses the 'fixture->sct_list' and returns -1 if
fails.
But the return value of the sk_SCT_push() is not checked.
I think it is better to check it just after the allocation.
CLA: trivial
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17571)
Diffstat (limited to 'test')
-rw-r--r-- | test/ct_test.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ct_test.c b/test/ct_test.c index d1799fa7a2..f914ee514a 100644 --- a/test/ct_test.c +++ b/test/ct_test.c @@ -449,6 +449,9 @@ static int test_encode_tls_sct(void) SETUP_CT_TEST_FIXTURE(); fixture->sct_list = sk_SCT_new_null(); + if (fixture->sct_list == NULL) + return 0; + if (!TEST_ptr(sct = SCT_new_from_base64(SCT_VERSION_V1, log_id, CT_LOG_ENTRY_TYPE_X509, timestamp, extensions, signature))) |