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)
This commit is contained in:
Frederik Wedel-Heinen 2024-12-21 15:15:11 +01:00 committed by Tomas Mraz
parent 3ffa64cd45
commit c626fda8a6
11 changed files with 39 additions and 18 deletions

View file

@ -1771,7 +1771,10 @@ static int capi_load_ssl_client_cert(ENGINE *e, SSL *ssl,
if (!certs)
certs = sk_X509_new_null();
sk_X509_push(certs, x);
if (!sk_X509_push(certs, x)) {
X509_free(x);
continue;
}
} else {
X509_free(x);
}