]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Prevent manipulation of a pointer if it is NULL in NTLM auth.
authoramosjeffries <>
Thu, 2 Aug 2007 08:08:25 +0000 (08:08 +0000)
committeramosjeffries <>
Thu, 2 Aug 2007 08:08:25 +0000 (08:08 +0000)
Coverity checker detected.
AuthNTLMUserRequest::authenticate attempted to locate the auth header.
If there is no header resulting it would still attempt to scan its ptr
 down the header text. This prevents the scanning occuring on NULL.

src/auth/ntlm/auth_ntlm.cc

index 6c899b83eb1497f1505a1153e28572da838d6e1d..e05b5998c8926146ae235b6481f74a1b43367029 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: auth_ntlm.cc,v 1.71 2007/07/04 00:55:31 hno Exp $
+ * $Id: auth_ntlm.cc,v 1.72 2007/08/02 02:08:25 amosjeffries Exp $
  *
  * DEBUG: section 29    NTLM Authenticator
  * AUTHOR: Robert Collins, Henrik Nordstrom, Francesco Chemolli
@@ -626,14 +626,17 @@ AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer
     /* locate second word */
     blob = proxy_auth;
 
-    while (xisspace(*blob) && *blob)
-        blob++;
+    /* if proxy_auth is actually NULL, we'd better not manipulate it. */
+    if(blob) {
+        while (xisspace(*blob) && *blob)
+            blob++;
 
-    while (!xisspace(*blob) && *blob)
-        blob++;
+        while (!xisspace(*blob) && *blob)
+            blob++;
 
-    while (xisspace(*blob) && *blob)
-        blob++;
+        while (xisspace(*blob) && *blob)
+            blob++;
+    }
 
     switch (auth_state) {