From 7c254e5e15067d3bef234e5419b0dabd7207d2ea Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 8 Aug 2023 10:27:19 +0200 Subject: [PATCH] kernel: Properly check memory bounds in strdup_from_user() Missed this one in 097353e779. --- kernel/src/memory/MemoryManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/src/memory/MemoryManager.cpp b/kernel/src/memory/MemoryManager.cpp index d597f397..abbdec06 100644 --- a/kernel/src/memory/MemoryManager.cpp +++ b/kernel/src/memory/MemoryManager.cpp @@ -508,7 +508,7 @@ namespace MemoryManager { TRY(result.try_append(*(char*)address)); address++; - if (address % ARCH_PAGE_SIZE) + if ((address % ARCH_PAGE_SIZE) == 0) { if (!validate_page_access(address, MMU::User)) return err(EFAULT); }