mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 08:00:24 +00:00
don't let VirtualProtect play with not committed memory
svn path=/trunk/; revision=38932
This commit is contained in:
parent
2eb7079e6c
commit
23ef53ceff
1 changed files with 14 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue