Updated ntdll-WRITECOPY patchset

Check return value pointer.
This commit is contained in:
Alistair Leslie-Hughes 2024-07-27 07:59:56 +10:00
parent 37551c99a2
commit b98458cadc

View File

@ -0,0 +1,30 @@
From d455916aec7649a816deb36c303341a6c7732a97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aida=20Jonikien=C4=97?= <aidas957@gmail.com>
Date: Fri, 26 Jul 2024 20:33:57 +0300
Subject: [PATCH] kernelbase: Handle NULL old_prot parameter in
VirtualProtect().
This fixes a segfault when launching any game with the EA Desktop application.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56694
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56711
---
dlls/kernelbase/memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c
index 2b0e674bb9b..d1408cf4c0e 100644
--- a/dlls/kernelbase/memory.c
+++ b/dlls/kernelbase/memory.c
@@ -548,7 +548,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH VirtualLock( void *addr, SIZE_T size )
BOOL WINAPI DECLSPEC_HOTPATCH VirtualProtect( void *addr, SIZE_T size, DWORD new_prot, DWORD *old_prot )
{
BOOL ret = VirtualProtectEx( GetCurrentProcess(), addr, size, new_prot, old_prot );
- if (*old_prot == PAGE_WRITECOPY) *old_prot = PAGE_READWRITE;
+ if (old_prot && *old_prot == PAGE_WRITECOPY) *old_prot = PAGE_READWRITE;
return ret;
}
--
2.43.0