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

Marcus Meissner marcus at jet.franken.de
Sat May 16 14:55:36 CDT 2009


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;
 }
-- 
1.5.6



More information about the wine-patches mailing list