Module: wine Branch: master Commit: 17eb6f44adec6f6ad43f861150a1d2473c79fde5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=17eb6f44adec6f6ad43f861150...
Author: Rob Shearman rob@codeweavers.com Date: Thu Dec 20 18:01:16 2007 +0000
rpcrt4: Print an error if stub buffer pointer is passed into safe_copy_from_buffer.
Also print an error message if there was an overflow.
---
dlls/rpcrt4/ndr_marshall.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 2322c78..c5cebea 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -664,7 +664,13 @@ static inline void safe_copy_from_buffer(MIDL_STUB_MESSAGE *pStubMsg, void *p, U { if ((pStubMsg->Buffer + size < pStubMsg->Buffer) || /* integer overflow of pStubMsg->Buffer */ (pStubMsg->Buffer + size > pStubMsg->BufferEnd)) + { + ERR("buffer overflow - Buffer = %p, BufferEnd = %p, size = %u\n", + pStubMsg->Buffer, pStubMsg->BufferEnd, size); RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + if (p == pStubMsg->Buffer) + ERR("pointer is the same as the buffer\n"); memcpy(p, pStubMsg->Buffer, size); pStubMsg->Buffer += size; }