[PATCH] winhttp: avoid NULL ptr dereference (Coverity 927)

Paul Vriens paul.vriens.wine at gmail.com
Tue May 19 06:46:31 CDT 2009


Marcus Meissner wrote:
> Hi,
> 
> Not sure if we need to set these values in all error paths,
> but definitely not in the NULL lpwhr. (lpwhdr?)
> 
> Ciao, Marcus
> ---
>  dlls/wininet/http.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
> index 212ff9f..53c3743 100644
> --- a/dlls/wininet/http.c
> +++ b/dlls/wininet/http.c
> @@ -3831,8 +3831,9 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
>  
>      TRACE("-->\n");
>  
> +    if (!lpwhr) goto lend2;
>  
> -    if (NULL == lpwhr ||  lpwhr->hdr.htype != WH_HHTTPREQ)
> +    if (lpwhr->hdr.htype != WH_HHTTPREQ)
>      {
>          INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
>          goto lend;
> @@ -3894,6 +3895,7 @@ lend:
>      lpwhr->read_pos = lpwhr->read_size = 0;
>      lpwhr->read_chunked = FALSE;
>  
> +lend2:
>      TRACE("%d <--\n", bSuccess);
>      return bSuccess;
>  }
Hi Marcus,

After AJ's remark you marked this Coverity one as "lpwhr can not be 
NULL". Should we thus delete the "NULL == lpwhr" altogether?

-- 
Cheers,

Paul.



More information about the wine-devel mailing list