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, 2 Jul 2013 21:12:19 +0000 (22:12 +0100)
crypto/cms/cms_sd.c

index b7dbf52..8f67289 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,