Commit 6763841e authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Make sure a signed encode message's signer info is always initialized.

parent 9ae5ef66
...@@ -1248,33 +1248,41 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags, ...@@ -1248,33 +1248,41 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags,
} }
else else
ret = FALSE; ret = FALSE;
if (ret && info->cSigners) if (ret)
{ {
msg->msg_data.info->rgSignerInfo = if (info->cSigners)
CryptMemAlloc(info->cSigners * sizeof(CMSG_SIGNER_INFO));
if (msg->msg_data.info->rgSignerInfo)
{ {
msg->msg_data.info->cSignerInfo = info->cSigners; msg->msg_data.info->rgSignerInfo =
memset(msg->msg_data.info->rgSignerInfo, 0, CryptMemAlloc(info->cSigners * sizeof(CMSG_SIGNER_INFO));
msg->msg_data.info->cSignerInfo * sizeof(CMSG_SIGNER_INFO)); if (msg->msg_data.info->rgSignerInfo)
ret = CSignedMsgData_AllocateHandles(&msg->msg_data);
for (i = 0; ret && i < msg->msg_data.info->cSignerInfo; i++)
{ {
ret = CSignerInfo_Construct( msg->msg_data.info->cSignerInfo = info->cSigners;
&msg->msg_data.info->rgSignerInfo[i], memset(msg->msg_data.info->rgSignerInfo, 0,
&info->rgSigners[i]); msg->msg_data.info->cSignerInfo * sizeof(CMSG_SIGNER_INFO));
if (ret) ret = CSignedMsgData_AllocateHandles(&msg->msg_data);
for (i = 0; ret && i < msg->msg_data.info->cSignerInfo; i++)
{ {
ret = CSignedMsgData_ConstructSignerHandles( ret = CSignerInfo_Construct(
&msg->msg_data, i, info->rgSigners[i].hCryptProv); &msg->msg_data.info->rgSignerInfo[i],
if (dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG) &info->rgSigners[i]);
CryptReleaseContext(info->rgSigners[i].hCryptProv, if (ret)
0); {
ret = CSignedMsgData_ConstructSignerHandles(
&msg->msg_data, i, info->rgSigners[i].hCryptProv);
if (dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG)
CryptReleaseContext(info->rgSigners[i].hCryptProv,
0);
}
} }
} }
else
ret = FALSE;
} }
else else
ret = FALSE; {
msg->msg_data.info->cSignerInfo = 0;
msg->msg_data.signerHandles = NULL;
}
} }
if (ret) if (ret)
ret = CRYPT_ConstructBlobArray( ret = CRYPT_ConstructBlobArray(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment