From 7e65d9439cd0141459cf3f0f3e1553c66518a71c Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 9 Jul 2007 10:55:42 -0700 Subject: [PATCH] crypt32: Make a copy of a passed-in stream info rather than assuming the pointer will live forever. --- dlls/crypt32/msg.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index f5f14915c24..7280642652c 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -39,7 +39,8 @@ typedef struct _CryptMsgBase { LONG ref; DWORD open_flags; - PCMSG_STREAM_INFO stream_info; + BOOL streamed; + CMSG_STREAM_INFO stream_info; BOOL finalized; CryptMsgCloseFunc close; CryptMsgUpdateFunc update; @@ -52,7 +53,16 @@ static inline void CryptMsgBase_Init(CryptMsgBase *msg, DWORD dwFlags, { msg->ref = 1; 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->get_param = get_param; msg->update = update; @@ -106,7 +116,7 @@ static BOOL CDataEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData, ret = CryptEncodeObjectEx(X509_ASN_ENCODING, X509_OCTET_STRING, &blob, CRYPT_ENCODE_ALLOC_FLAG, NULL, &msg->bare_content, &msg->bare_content_len); - if (ret && msg->base.stream_info) + if (ret && msg->base.streamed) FIXME("stream info unimplemented\n"); } }