summaryrefslogtreecommitdiffstats
path: root/apps/crl2pkcs7.c
diff options
context:
space:
mode:
authorFrederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>2024-12-21 15:15:11 +0100
committerTomas Mraz <tomas@openssl.org>2025-01-08 11:11:00 +0100
commitc626fda8a66a203d9f1435c34fcd3f7bda89d068 (patch)
treefe5219f4edf21176b559b96230cc68e9da0986e9 /apps/crl2pkcs7.c
parentPass functions with correct signatures to the evp_generic_fetch_xxx methods (diff)
downloadopenssl-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 'apps/crl2pkcs7.c')
-rw-r--r--apps/crl2pkcs7.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/crl2pkcs7.c b/apps/crl2pkcs7.c
index 681c60285f..ba24d31d5f 100644
--- a/apps/crl2pkcs7.c
+++ b/apps/crl2pkcs7.c
@@ -216,7 +216,10 @@ static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
while (sk_X509_INFO_num(sk)) {
xi = sk_X509_INFO_shift(sk);
if (xi->x509 != NULL) {
- sk_X509_push(stack, xi->x509);
+ if (!sk_X509_push(stack, xi->x509)) {
+ X509_INFO_free(xi);
+ goto end;
+ }
xi->x509 = NULL;
count++;
}