crypt32(3/10): Make a copy of a passed-in stream info...

Juan Lang juan.lang at gmail.com
Mon Jul 9 13:49:46 CDT 2007


rather than assuming the pointer will live forever
--Juan
-------------- next part --------------
From ba7a8cc644b0b2500ef76e6c7e9ff19a30022033 Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Mon, 9 Jul 2007 10:55:42 -0700
Subject: [PATCH] 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(Cry
 {
     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(HCRYPT
             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");
         }
     }
-- 
1.4.1


More information about the wine-patches mailing list