summaryrefslogtreecommitdiffstats
path: root/crypto/cms
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-05-03 21:58:02 +0200
committerDr. David von Oheimb <dev@ddvo.net>2021-05-19 09:23:41 +0200
commit8a734d3aaf4e4784581b87cdf2a4b3e2c2403b97 (patch)
treef08d3cf616312d586f4dc68f29eb8720f139f078 /crypto/cms
parent1b96cc70eb466f12b5abd9d90900e875a2236509 (diff)
CMS_get0_SignerInfos(): Prevent spurious error on cms_get0_signed() failure
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12959)
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms_sd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index d208822c4b..c0235b6962 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)