Rob Shearman : rpcrt4: Don't use BufferEnd in RpcStream_Write.

Alexandre Julliard julliard at winehq.org
Thu Dec 20 06:21:40 CST 2007


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Wed Dec 19 14:53:40 2007 +0000

rpcrt4: Don't use BufferEnd in RpcStream_Write.

It is usually used during marshalling, where pStubMsg->BufferStart and 
pStubMsg->BufferEnd won't be valid. Replace it with a check using 
RpcMsg->Buffer and pStubMsg->BufferLength.

---

 dlls/rpcrt4/ndr_ole.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/rpcrt4/ndr_ole.c b/dlls/rpcrt4/ndr_ole.c
index 0a8c1f2..5c1845a 100644
--- a/dlls/rpcrt4/ndr_ole.c
+++ b/dlls/rpcrt4/ndr_ole.c
@@ -82,7 +82,7 @@ typedef struct RpcStreamImpl
   DWORD RefCount;
   PMIDL_STUB_MESSAGE pMsg;
   LPDWORD size;
-  char *data;
+  unsigned char *data;
   DWORD pos;
 } RpcStreamImpl;
 
@@ -145,7 +145,7 @@ static HRESULT WINAPI RpcStream_Write(LPSTREAM iface,
                                      ULONG *pcbWritten)
 {
   RpcStreamImpl *This = (RpcStreamImpl *)iface;
-  if (This->data + cb > (char *)This->pMsg->BufferEnd)
+  if (This->data + cb > (unsigned char *)This->pMsg->RpcMsg->Buffer + This->pMsg->BufferLength)
     return STG_E_MEDIUMFULL;
   memcpy(This->data + This->pos, pv, cb);
   This->pos += cb;
@@ -215,7 +215,7 @@ static LPSTREAM RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init)
   This->RefCount = 1;
   This->pMsg = pStubMsg;
   This->size = (LPDWORD)pStubMsg->Buffer;
-  This->data = (char*)(This->size + 1);
+  This->data = (unsigned char*)(This->size + 1);
   This->pos = 0;
   if (init) *This->size = 0;
   TRACE("init size=%d\n", *This->size);




More information about the wine-cvs mailing list