crypt32: Make a copy of a passed-in stream info rather than assuming the pointer will live forever.
This commit is contained in:
parent
fd05fe0d13
commit
7e65d9439c
|
@ -39,7 +39,8 @@ typedef struct _CryptMsgBase
|
||||||
{
|
{
|
||||||
LONG ref;
|
LONG ref;
|
||||||
DWORD open_flags;
|
DWORD open_flags;
|
||||||
PCMSG_STREAM_INFO stream_info;
|
BOOL streamed;
|
||||||
|
CMSG_STREAM_INFO stream_info;
|
||||||
BOOL finalized;
|
BOOL finalized;
|
||||||
CryptMsgCloseFunc close;
|
CryptMsgCloseFunc close;
|
||||||
CryptMsgUpdateFunc update;
|
CryptMsgUpdateFunc update;
|
||||||
|
@ -52,7 +53,16 @@ static inline void CryptMsgBase_Init(CryptMsgBase *msg, DWORD dwFlags,
|
||||||
{
|
{
|
||||||
msg->ref = 1;
|
msg->ref = 1;
|
||||||
msg->open_flags = dwFlags;
|
msg->open_flags = dwFlags;
|
||||||
msg->stream_info = pStreamInfo;
|
if (pStreamInfo)
|
||||||
|
{
|
||||||
|
msg->streamed = TRUE;
|
||||||
|
memcpy(&msg->stream_info, pStreamInfo, sizeof(msg->stream_info));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg->streamed = FALSE;
|
||||||
|
memset(&msg->stream_info, 0, sizeof(msg->stream_info));
|
||||||
|
}
|
||||||
msg->close = close;
|
msg->close = close;
|
||||||
msg->get_param = get_param;
|
msg->get_param = get_param;
|
||||||
msg->update = update;
|
msg->update = update;
|
||||||
|
@ -106,7 +116,7 @@ static BOOL CDataEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
|
||||||
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, X509_OCTET_STRING,
|
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, X509_OCTET_STRING,
|
||||||
&blob, CRYPT_ENCODE_ALLOC_FLAG, NULL, &msg->bare_content,
|
&blob, CRYPT_ENCODE_ALLOC_FLAG, NULL, &msg->bare_content,
|
||||||
&msg->bare_content_len);
|
&msg->bare_content_len);
|
||||||
if (ret && msg->base.stream_info)
|
if (ret && msg->base.streamed)
|
||||||
FIXME("stream info unimplemented\n");
|
FIXME("stream info unimplemented\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue