diff options
author | Frederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk> | 2024-12-21 15:15:11 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2025-01-08 11:11:00 +0100 |
commit | c626fda8a66a203d9f1435c34fcd3f7bda89d068 (patch) | |
tree | fe5219f4edf21176b559b96230cc68e9da0986e9 /test | |
parent | Pass functions with correct signatures to the evp_generic_fetch_xxx methods (diff) | |
download | openssl-c626fda8a66a203d9f1435c34fcd3f7bda89d068.tar.xz openssl-c626fda8a66a203d9f1435c34fcd3f7bda89d068.zip |
Check returns of various sk_*_push functions
Check returns of sk_POLICY_MAPPING_push, sk_GENERAL_NAME_push,
sk_ACCESS_DESCRIPTION_push, sk_X509_push, sk_X509_NAME_push,
sk_OPENSSL_CSTRING_push, sk_SCT_push, sk_DIST_POINT_push,
sk_OSSL_CMP_CRLSTATUS_push, sk_ASN1_UTF8STRING_push and
sk_ASN1_OBJECT_push and handle appropriately.
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26240)
Diffstat (limited to '')
-rw-r--r-- | test/cmp_client_test.c | 7 | ||||
-rw-r--r-- | test/ct_test.c | 6 | ||||
-rw-r--r-- | test/v3nametest.c | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/test/cmp_client_test.c b/test/cmp_client_test.c index 208e0a1767..bacdac35c5 100644 --- a/test/cmp_client_test.c +++ b/test/cmp_client_test.c @@ -187,8 +187,11 @@ static int test_exec_IR_ses(void) fixture->req_type = OSSL_CMP_PKIBODY_IR; fixture->expected = OSSL_CMP_PKISTATUS_accepted; fixture->caPubs = sk_X509_new_null(); - sk_X509_push(fixture->caPubs, server_cert); - sk_X509_push(fixture->caPubs, server_cert); + if (!sk_X509_push(fixture->caPubs, server_cert) + || !sk_X509_push(fixture->caPubs, server_cert)) { + tear_down(fixture); + return 0; + } ossl_cmp_mock_srv_set1_caPubsOut(fixture->srv_ctx, fixture->caPubs); EXECUTE_TEST(execute_exec_certrequest_ses_test, tear_down); return result; diff --git a/test/ct_test.c b/test/ct_test.c index ff253414f8..b54d7d0fc4 100644 --- a/test/ct_test.c +++ b/test/ct_test.c @@ -463,7 +463,11 @@ static int test_encode_tls_sct(void) return 0; } - sk_SCT_push(fixture->sct_list, sct); + if (!sk_SCT_push(fixture->sct_list, sct)) { + tear_down(fixture); + return 0; + } + fixture->sct_dir = ct_dir; fixture->sct_text_file = "tls1.sct"; EXECUTE_CT_TEST(); diff --git a/test/v3nametest.c b/test/v3nametest.c index 3609eba045..73767abf46 100644 --- a/test/v3nametest.c +++ b/test/v3nametest.c @@ -157,7 +157,8 @@ static int set_altname(X509 *crt, ...) default: abort(); } - sk_GENERAL_NAME_push(gens, gen); + if (!sk_GENERAL_NAME_push(gens, gen)) + goto out; gen = NULL; } if (!X509_add1_ext_i2d(crt, NID_subject_alt_name, gens, 0, 0)) |