From 30ea6e3ea323c7d30b50e2f81eb379b1d23c7a33 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Sat, 10 Apr 2021 13:19:08 +0200 Subject: [PATCH] [Kernel/Memory] Return error when region_size is 0 --- src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc index 25d6b0347..d53539286 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc @@ -80,7 +80,7 @@ dword_result_t NtAllocateVirtualMemory(lpdword_t base_addr_ptr, // it's simple today we could extend it to do better things in the future. // Must request a size. - if (!base_addr_ptr || !region_size_ptr) { + if (!base_addr_ptr || !region_size_ptr || !*region_size_ptr) { return X_STATUS_INVALID_PARAMETER; } // Check allocation type. @@ -198,7 +198,7 @@ dword_result_t NtProtectVirtualMemory(lpdword_t base_addr_ptr, assert_true(debug_memory == 0); // Must request a size. - if (!base_addr_ptr || !region_size_ptr) { + if (!base_addr_ptr || !region_size_ptr || !*region_size_ptr) { return X_STATUS_INVALID_PARAMETER; }