From 3bc76edec019226620e19ffe75d0e89b1c4374e6 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 7 Feb 2023 03:21:39 +0200 Subject: [PATCH] Security fix for allocating pages for user-mode --- Core/Memory/MemoryManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Core/Memory/MemoryManager.cpp b/Core/Memory/MemoryManager.cpp index d9930fa..363658f 100644 --- a/Core/Memory/MemoryManager.cpp +++ b/Core/Memory/MemoryManager.cpp @@ -124,6 +124,11 @@ namespace Memory } AllocatedPagesList.push_back({Address, Count}); + + /* For security reasons, we clear the memory + if the page is user accessible. */ + if (User) + memset(Address, 0, Count * PAGE_SIZE); return Address; }