Commit d3c8b59e authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Pass address of blob to store data rather than message to CDecodeMsg_CopyData.

parent 1b7121e7
......@@ -1518,22 +1518,22 @@ static void CDecodeMsg_Close(HCRYPTMSG hCryptMsg)
ContextPropertyList_Free(msg->properties);
}
static BOOL CDecodeMsg_CopyData(CDecodeMsg *msg, const BYTE *pbData,
static BOOL CDecodeMsg_CopyData(CRYPT_DATA_BLOB *blob, const BYTE *pbData,
DWORD cbData)
{
BOOL ret = TRUE;
if (cbData)
{
if (msg->msg_data.cbData)
msg->msg_data.pbData = CryptMemRealloc(msg->msg_data.pbData,
msg->msg_data.cbData + cbData);
if (blob->cbData)
blob->pbData = CryptMemRealloc(blob->pbData,
blob->cbData + cbData);
else
msg->msg_data.pbData = CryptMemAlloc(cbData);
if (msg->msg_data.pbData)
blob->pbData = CryptMemAlloc(cbData);
if (blob->pbData)
{
memcpy(msg->msg_data.pbData + msg->msg_data.cbData, pbData, cbData);
msg->msg_data.cbData += cbData;
memcpy(blob->pbData + blob->cbData, pbData, cbData);
blob->cbData += cbData;
}
else
ret = FALSE;
......@@ -1768,7 +1768,7 @@ static BOOL CDecodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
if (msg->base.open_flags & CMSG_DETACHED_FLAG &&
msg->base.state != MsgStateDataFinalized)
{
ret = CDecodeMsg_CopyData(msg, pbData, cbData);
ret = CDecodeMsg_CopyData(&msg->msg_data, pbData, cbData);
msg->base.state = MsgStateDataFinalized;
if (ret)
ret = CDecodeMsg_DecodeContent(msg, &msg->msg_data,
......@@ -1784,7 +1784,7 @@ static BOOL CDecodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
}
else
{
ret = CDecodeMsg_CopyData(msg, pbData, cbData);
ret = CDecodeMsg_CopyData(&msg->msg_data, pbData, cbData);
if (msg->base.state == MsgStateInit)
msg->base.state = MsgStateUpdated;
}
......@@ -1797,7 +1797,7 @@ static BOOL CDecodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
{
if (msg->base.state == MsgStateInit)
{
ret = CDecodeMsg_CopyData(msg, pbData, cbData);
ret = CDecodeMsg_CopyData(&msg->msg_data, pbData, cbData);
if (ret)
ret = CDecodeMsg_DecodeContent(msg, &msg->msg_data,
msg->type);
......
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