Skip to content

Commit

Permalink
test/ct_test.c: Add the missing check after calling sk_SCT_new_null
Browse files Browse the repository at this point in the history
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 <[email protected]>

Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#17571)
JiangJias authored and t8m committed Jan 25, 2022
1 parent 2208ba5 commit 7625d70
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/ct_test.c
Original file line number Diff line number Diff line change
@@ -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)))

0 comments on commit 7625d70

Please sign in to comment.