[Kernel/Memory] Added check for zeroing noaccess or readonly pages

This commit is contained in:
Gliniak 2020-09-20 19:38:23 +02:00
parent fc15a0a0dc
commit e130f666b4
1 changed files with 2 additions and 1 deletions

View File

@ -163,7 +163,8 @@ dword_result_t NtAllocateVirtualMemory(lpdword_t base_addr_ptr,
// Zero memory, if needed.
if (address && !(alloc_type & X_MEM_NOZERO)) {
if (alloc_type & X_MEM_COMMIT) {
if (alloc_type & X_MEM_COMMIT &&
!(protect_bits & (X_PAGE_NOACCESS | X_PAGE_READONLY))) {
kernel_memory()->Zero(address, adjusted_size);
}
}