Commit c7eb844c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

kernel32: Lock heap and validate pointer in LocalHandle.

parent d918919d
......@@ -343,6 +343,7 @@ UINT WINAPI LocalFlags( HLOCAL handle )
*/
HLOCAL WINAPI LocalHandle( const void *ptr )
{
HANDLE heap = GetProcessHeap();
HLOCAL handle = (HANDLE)ptr;
ULONG flags;
......@@ -354,11 +355,14 @@ HLOCAL WINAPI LocalHandle( const void *ptr )
return 0;
}
if (!RtlGetUserInfoHeap( GetProcessHeap(), 0, (void *)ptr, &handle, &flags ))
RtlLockHeap( heap );
if (!HeapValidate( heap, HEAP_NO_SERIALIZE, ptr ) ||
!RtlGetUserInfoHeap( heap, HEAP_NO_SERIALIZE, (void *)ptr, &handle, &flags ))
{
SetLastError( ERROR_INVALID_HANDLE );
return 0;
handle = 0;
}
RtlUnlockHeap( heap );
return handle;
}
......
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