Juan Lang : crypt32: Make a copy of a passed-in stream info rather than assuming the pointer will live forever .

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 10 08:02:38 CDT 2007


Module: wine
Branch: master
Commit: 7e65d9439cd0141459cf3f0f3e1553c66518a71c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7e65d9439cd0141459cf3f0f3e1553c66518a71c

Author: Juan Lang <juan.lang at gmail.com>
Date:   Mon Jul  9 10:55:42 2007 -0700

crypt32: Make a copy of a passed-in stream info rather than assuming the pointer will live forever.

---

 dlls/crypt32/msg.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index f5f1491..7280642 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");
         }
     }




More information about the wine-cvs mailing list