kernel32: K32EnumProcessModules: Handle NULL pointer gracefully.

Olivier F. R. Dierick o.dierick at
Tue Jun 30 16:29:21 CDT 2015

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 at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-K32EnumProcessModules-Handle-NULL-pointer-gracefully.patch.txt
Type: application/mbox
Size: 800 bytes
Desc: not available
URL: <>

More information about the wine-patches mailing list