From: Bernd Edlinger Date: Fri, 16 Aug 2019 13:32:32 +0000 (+0200) Subject: Fix error handling in X509_chain_up_ref X-Git-Tag: OpenSSL_1_0_2t~17 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7fafaf27c2c2990fde2798424a38ce8443dae595;p=oweals%2Fopenssl.git Fix error handling in X509_chain_up_ref Reviewed-by: Kurt Roeckx Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/9615) --- diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c index 2d82f8fa8b..a7b90e6a42 100644 --- a/crypto/x509/x509_cmp.c +++ b/crypto/x509/x509_cmp.c @@ -490,6 +490,8 @@ STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain) STACK_OF(X509) *ret; int i; ret = sk_X509_dup(chain); + if (ret == NULL) + return NULL; for (i = 0; i < sk_X509_num(ret); i++) { X509 *x = sk_X509_value(ret, i); CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);