]> granicus.if.org Git - openssl/commitdiff
Initialise CMS signature buffer length properly.
authorDr. Stephen Henson <steve@openssl.org>
Tue, 2 Jul 2013 21:11:27 +0000 (22:11 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 1 Oct 2013 13:01:17 +0000 (14:01 +0100)
(cherry picked from commit e0f7cfda68881da6829ea39430e1a5c28ed05ece)

crypto/cms/cms_sd.c

index b7eb9626e7b84110b641fa9ebb7accc14c450335..25af94136a7f16814d2c0ca5b26441a0342b1669 100644 (file)
@@ -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,