From 8385f137b50242c632bd8f91a495a2b7e5adfee4 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 1 Dec 2006 11:38:52 +0100 Subject: [PATCH] ntdll: Don't free the DOS area when a broken app passes a NULL pointer to NtFreeVirtualMemory. --- dlls/ntdll/virtual.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index c62390ac512..573072e2391 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1430,6 +1430,9 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si size = ROUND_SIZE( addr, size ); base = ROUND_ADDR( addr, page_mask ); + /* avoid freeing the DOS area when a broken app passes a NULL pointer */ + if (!base && !(type & MEM_SYSTEM)) return STATUS_INVALID_PARAMETER; + RtlEnterCriticalSection(&csVirtual); if (!(view = VIRTUAL_FindView( base )) ||