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.
This commit is contained in:
Rob Shearman 2007-12-20 18:01:16 +00:00 committed by Alexandre Julliard
parent 72c5aea600
commit 17eb6f44ad
1 changed files with 6 additions and 0 deletions

View File

@ -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;
}