Fix the overflow check to not depend on pStubMsg->BufferStart and

pStubMsg->BufferEnd being valid, because they aren't filled in when
using MIDL-generated server stubs.
Don't set the pointer to NULL on unmarshaling because we may want to
unmarshal the value to an existing pointer instead of allocating a new
one.
This commit is contained in:
Robert Shearman 2005-11-29 10:41:17 +01:00 committed by Alexandre Julliard
parent e95464a5cb
commit 552f18211d
1 changed files with 3 additions and 4 deletions

View File

@ -97,8 +97,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
#define STD_OVERFLOW_CHECK(_Msg) do { \
TRACE("buffer=%d/%ld\n", _Msg->Buffer - _Msg->BufferStart, _Msg->BufferLength); \
if (_Msg->Buffer > _Msg->BufferEnd) ERR("buffer overflow %d bytes\n", _Msg->Buffer - _Msg->BufferEnd); \
TRACE("buffer=%d/%ld\n", _Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer, _Msg->BufferLength); \
if (_Msg->Buffer > (unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength) \
ERR("buffer overflow %d bytes\n", _Msg->Buffer - ((unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength)); \
} while (0)
#define NDR_TABLE_SIZE 128
@ -752,8 +753,6 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
*pPointer = NULL;
if (pointer_id) {
m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
if (m) m(pStubMsg, pPointer, desc, fMustAlloc);