[PATCH] kernel32: handle section=NULL in WritePrivateProfileStructW (Coverity)

Nikolay Sivov bunglehead at gmail.com
Sun Feb 1 11:36:44 CST 2009


Marcus Meissner wrote:
> Hi,
>
> CID 69, section name NULL will just crash in the calls below and
> without it we cannot work anyway. So return FALSE;
>
> Ciao, Marcus
> ---
>  dlls/kernel32/profile.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
> index 3c5ef1c..5dddc23 100644
> --- a/dlls/kernel32/profile.c
> +++ b/dlls/kernel32/profile.c
> @@ -1799,6 +1799,8 @@ BOOL WINAPI WritePrivateProfileStructW (LPCWSTR section, LPCWSTR key,
>  
>      if (!section && !key && !buf)  /* flush the cache */
>          return WritePrivateProfileStringW( NULL, NULL, NULL, filename );
> +    if (!section)
> +        return FALSE;
>  
>      /* allocate string buffer for hex chars + checksum hex char + '\0' */
>      outstring = HeapAlloc( GetProcessHeap(), 0, (bufsize*2 + 2 + 1) * sizeof(WCHAR) );
>   
What about a test on this? Does native module crash or not?



More information about the wine-devel mailing list