Added null check in GlobalHandle.

This commit is contained in:
Guy Albertelli 2000-01-15 21:59:12 +00:00 committed by Alexandre Julliard
parent afa4315507
commit 9867997450

View file

@ -1141,7 +1141,14 @@ HGLOBAL WINAPI GlobalHandle(
LPCVOID pmem /* [in] Pointer to global memory block */
) {
HGLOBAL handle;
HANDLE heap = GLOBAL_GetHeap( POINTER_TO_HANDLE(pmem) );
HANDLE heap;
if (!pmem)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
heap = GLOBAL_GetHeap( POINTER_TO_HANDLE(pmem) );
if (!HEAP_IsInsideHeap( heap, 0, pmem )) goto error;
handle = POINTER_TO_HANDLE(pmem);