From 6382c8af3f44629ad9f3ccab046a3728800fb203 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Wed, 19 Dec 2007 14:53:40 +0000 Subject: [PATCH] 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 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/rpcrt4/ndr_ole.c b/dlls/rpcrt4/ndr_ole.c index 0a8c1f22797..5c1845a2e1d 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);