mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 00:20:34 +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,
|
Region = MmFindRegion(MemoryArea->StartingAddress,
|
||||||
&MemoryArea->Data.VirtualMemoryData.RegionListHead,
|
&MemoryArea->Data.VirtualMemoryData.RegionListHead,
|
||||||
BaseAddress, NULL);
|
BaseAddress, NULL);
|
||||||
*OldProtect = Region->Protect;
|
if (Region->Type == MEM_COMMIT)
|
||||||
Status = MmAlterRegion(AddressSpace, MemoryArea->StartingAddress,
|
{
|
||||||
&MemoryArea->Data.VirtualMemoryData.RegionListHead,
|
/* FIXME: check if the whole range is committed
|
||||||
BaseAddress, Length, Region->Type, Protect,
|
* before altering the memory */
|
||||||
MmModifyAttributes);
|
*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);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue