From b9c92e95642325c99f83b4c2cbb610a5b01a47e3 Mon Sep 17 00:00:00 2001
From: Rob Shearman <rob@codeweavers.com>
Date: Mon, 17 Dec 2007 18:20:34 +0000
Subject: [PATCH] rpcrt4: Don't copy memory from the buffer in
 NdrConformantStringUnmarshall if we just pointed the memory pointer into the
 buffer.

(Reported by Dan Kegel.)
---
 dlls/rpcrt4/ndr_marshall.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 2de650d1824..ca40bfa8074 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -890,7 +890,8 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
       *ppMemory = NdrAllocate(pStubMsg, memsize);
   }
 
-  safe_copy_from_buffer(pStubMsg, *ppMemory, bufsize);
+  if (*ppMemory != pStubMsg->Buffer)
+    safe_copy_from_buffer(pStubMsg, *ppMemory, bufsize);
 
   if (*pFormat == RPC_FC_C_CSTRING) {
     TRACE("string=%s\n", debugstr_a((char*)*ppMemory));
-- 
GitLab