mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 19:26:33 +00:00
don't let VirtualProtect play with not committed memory
svn path=/trunk/; revision=38932
This commit is contained in:
@@ -1028,11 +1028,20 @@ MmProtectAnonMem(PMM_AVL_TABLE AddressSpace,
|
||||
Region = MmFindRegion(MemoryArea->StartingAddress,
|
||||
&MemoryArea->Data.VirtualMemoryData.RegionListHead,
|
||||
BaseAddress, NULL);
|
||||
*OldProtect = Region->Protect;
|
||||
Status = MmAlterRegion(AddressSpace, MemoryArea->StartingAddress,
|
||||
&MemoryArea->Data.VirtualMemoryData.RegionListHead,
|
||||
BaseAddress, Length, Region->Type, Protect,
|
||||
MmModifyAttributes);
|
||||
if (Region->Type == MEM_COMMIT)
|
||||
{
|
||||
/* FIXME: check if the whole range is committed
|
||||
* before altering the memory */
|
||||
*OldProtect = Region->Protect;
|
||||
Status = MmAlterRegion(AddressSpace, MemoryArea->StartingAddress,
|
||||
&MemoryArea->Data.VirtualMemoryData.RegionListHead,
|
||||
BaseAddress, Length, Region->Type, Protect,
|
||||
MmModifyAttributes);
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = STATUS_NOT_COMMITTED;
|
||||
}
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user