ChangeSet ID: 21517 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/11/29 05:04:45
Modified files: dlls/rpcrt4 : ndr_marshall.c
Log message: Robert Shearman rob@codeweavers.com 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.
Patch: http://cvs.winehq.org/patch.py?id=21517
Old revision New revision Changes Path 1.37 1.38 +3 -4 wine/dlls/rpcrt4/ndr_marshall.c
Index: wine/dlls/rpcrt4/ndr_marshall.c diff -u -p wine/dlls/rpcrt4/ndr_marshall.c:1.37 wine/dlls/rpcrt4/ndr_marshall.c:1.38 --- wine/dlls/rpcrt4/ndr_marshall.c:1.37 29 Nov 2005 11: 4:45 -0000 +++ wine/dlls/rpcrt4/ndr_marshall.c 29 Nov 2005 11: 4:45 -0000 @@ -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 RpcRaiseException(RPC_X_BAD_STUB_DATA); }
- *pPointer = NULL; - if (pointer_id) { m = NdrUnmarshaller[*desc & NDR_TABLE_MASK]; if (m) m(pStubMsg, pPointer, desc, fMustAlloc);