Commit 8e08b1dd authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

rpcrt4: Use safe_copy_from_buffer instead of direct memory copy in NdrBaseTypeUnmarshall.

This makes the code check that the buffer is big enough to read from before copying the data from it. The safe_buffer_increment call is still needed for the case where we point the memory to the buffer, so move the call there.
parent c871d9a8
......@@ -6051,15 +6051,15 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
{ \
*ppMemory = pStubMsg->Buffer; \
TRACE("*ppMemory: %p\n", *ppMemory); \
safe_buffer_increment(pStubMsg, sizeof(type)); \
} \
else \
{ \
if (fMustAlloc) \
*ppMemory = NdrAllocate(pStubMsg, sizeof(type)); \
TRACE("*ppMemory: %p\n", *ppMemory); \
**(type **)ppMemory = *(type *)pStubMsg->Buffer; \
} \
safe_buffer_increment(pStubMsg, sizeof(type));
safe_copy_from_buffer(pStubMsg, *ppMemory, sizeof(type)); \
}
switch(*pFormat)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment