From: "Olivier F. R. Dierick" Subject: kernel32: K32EnumProcessModules: Handle NULL pointer gracefully. Message-Id: <1435699761.11000.22.camel@piezo3.piezo-forte.be> Date: Tue, 30 Jun 2015 23:29:21 +0200 This patch addresses bug 38841: PunkBuster calls K32EnumProcessModules with a NULL pointer as parameter 'lphModule' and a non-zero value as parameter 'cb'. 'cb' tells how much space is available in the array pointed to by 'lphModule'. The current Wine code checks if 'cb' is large enough to put an HMODULE in the array. If it is, the function writes the HMODULE to the array. It continues until there is no more space, or all HMODULEs have been iterated. When 'lphModule' is NULL an exception error is thrown when writing to it. The patch addresses this by adding a check to the 'lphModule' parameter, and making the function return an error status if it is NULL. --- dlls/kernel32/module.c | 6 ++++++ 1 file changed, 6 insertions(+) -- Olivier F. R. Dierick o.dierick@piezo-forte.be From 6969863e4257dab4f48768cd5bc1f216ae50a594 Mon Sep 17 00:00:00 2001 From: "Olivier F. R. Dierick" Date: Tue, 30 Jun 2015 05:57:51 +0200 Subject: K32EnumProcessModules: Handle NULL pointer gracefully. --- dlls/kernel32/module.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c index f495e81..5461881 100644 --- a/dlls/kernel32/module.c +++ b/dlls/kernel32/module.c @@ -1226,6 +1226,12 @@ BOOL WINAPI K32EnumProcessModules(HANDLE process, HMODULE *lphModule, if (!init_module_iterator(&iter, process)) return FALSE; + if (!lphModule) + { + SetLastError(ERROR_NOACCESS); + return FALSE; + } + if (!needed) { SetLastError(ERROR_NOACCESS); -- 1.7.10.4