From: Dr. David von Oheimb Date: Mon, 3 May 2021 19:58:02 +0000 (+0200) Subject: CMS_get0_SignerInfos(): Prevent spurious error on cms_get0_signed() failure X-Git-Tag: openssl-3.0.0-alpha17~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a734d3aaf4e4784581b87cdf2a4b3e2c2403b97;p=thirdparty%2Fopenssl.git CMS_get0_SignerInfos(): Prevent spurious error on cms_get0_signed() failure Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/12959) --- diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index d208822c4b2..c0235b69624 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -496,9 +496,13 @@ void ossl_cms_SignerInfos_set_cmsctx(CMS_ContentInfo *cms) { int i; CMS_SignerInfo *si; - STACK_OF(CMS_SignerInfo) *sinfos = CMS_get0_SignerInfos(cms); + STACK_OF(CMS_SignerInfo) *sinfos; const CMS_CTX *ctx = ossl_cms_get0_cmsctx(cms); + ERR_set_mark(); + sinfos = CMS_get0_SignerInfos(cms); + ERR_pop_to_mark(); /* removes error in case sinfos == NULL */ + for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++) { si = sk_CMS_SignerInfo_value(sinfos, i); if (si != NULL)