diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index b7dbf52ab1ef0d5908658a3e9080cf756c52348b..8f672890a076f6089b7ef41ab988e025c0f0533a 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -700,7 +700,8 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, pctx = si->pctx; if (!EVP_DigestFinal_ex(&mctx, md, &mdlen)) goto err; - sig = OPENSSL_malloc(EVP_PKEY_size(si->pkey)); + siglen = EVP_PKEY_size(si->pkey); + sig = OPENSSL_malloc(siglen); if (!sig) { CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN,