Robert Shearman : rpcrt4: The NDR memory sizing functions should increment the buffer pointer, so make sure to save it before calling one of these and restore it afterwards .

Alexandre Julliard julliard at wine.codeweavers.com
Mon May 15 07:35:07 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 628c5e9bafacb8fe0258e6690a453bdfff88b38e
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=628c5e9bafacb8fe0258e6690a453bdfff88b38e

Author: Robert Shearman <rob at codeweavers.com>
Date:   Sat May 13 16:58:43 2006 +0100

rpcrt4: The NDR memory sizing functions should increment the buffer pointer, so make sure to save it before calling one of these and restore it afterwards.

---

 dlls/rpcrt4/ndr_marshall.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 6dc1a03..7897695 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -2289,6 +2289,7 @@ unsigned char * WINAPI NdrComplexArrayUn
   ULONG count, esize;
   unsigned char alignment;
   unsigned char *pMemory;
+  unsigned char *Buffer;
 
   TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
 
@@ -2306,7 +2307,9 @@ unsigned char * WINAPI NdrComplexArrayUn
   pFormat = ReadConformance(pStubMsg, pFormat);
   pFormat = ReadVariance(pStubMsg, pFormat);
 
+  Buffer = pStubMsg->Buffer;
   esize = ComplexStructSize(pStubMsg, pFormat);
+  pStubMsg->Buffer = Buffer;
 
   if (fMustAlloc || !*ppMemory)
   {
@@ -3423,7 +3426,11 @@ static unsigned char *WINAPI NdrBaseType
     TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false");
 
     if (fMustAlloc || !*ppMemory)
+    {
+        unsigned char *Buffer = pStubMsg->Buffer;
         *ppMemory = NdrAllocate(pStubMsg, NdrBaseTypeMemorySize(pStubMsg, pFormat));
+        pStubMsg->Buffer = Buffer;
+    }
 
     TRACE("*ppMemory: %p\n", *ppMemory);
 




More information about the wine-cvs mailing list