Paul Gofman : kernel32: Zero initialize module data in fetch_module().

Alexandre Julliard julliard at winehq.org
Wed Jul 22 16:34:29 CDT 2020


Module: wine
Branch: master
Commit: 3d54677586eb0a9f379839cd06c04d03fde380f7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3d54677586eb0a9f379839cd06c04d03fde380f7

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Wed Jul 22 16:06:12 2020 +0300

kernel32: Zero initialize module data in fetch_module().

Otherwise unitialized name string pointers may be freed
in CreateToolhelp32Snapshot().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49590
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/toolhelp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/toolhelp.c b/dlls/kernel32/toolhelp.c
index d55e8185f2..d072ccaefc 100644
--- a/dlls/kernel32/toolhelp.c
+++ b/dlls/kernel32/toolhelp.c
@@ -108,9 +108,9 @@ static BOOL fetch_module( DWORD process, DWORD flags, LDR_DATA_TABLE_ENTRY **ldr
             while (curr != head)
             {
                 if (!*num)
-                    *ldr_mod = HeapAlloc( GetProcessHeap(), 0, sizeof(LDR_DATA_TABLE_ENTRY) );
+                    *ldr_mod = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LDR_DATA_TABLE_ENTRY) );
                 else
-                    *ldr_mod = HeapReAlloc( GetProcessHeap(), 0, *ldr_mod,
+                    *ldr_mod = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, *ldr_mod,
                                             (*num + 1) * sizeof(LDR_DATA_TABLE_ENTRY) );
                 if (!*ldr_mod) break;
                 if (!ReadProcessMemory( hProcess,




More information about the wine-cvs mailing list