kernel32: K32EnumProcessModules: Handle NULL pointer gracefully.

Alex Henrie alexhenrie24 at gmail.com
Tue Jun 30 17:04:00 CDT 2015


> 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);

Wouldn't it be easier to write "if (!lphModule || !needed)"? Adding a
test or two would also be nice.

-Alex



More information about the wine-devel mailing list