]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix configure parsing IP/domain directives
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 10 Sep 2013 07:34:29 +0000 (01:34 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 10 Sep 2013 07:34:29 +0000 (01:34 -0600)
Squid would semi-silently accept invalid IP address or hostname in some
directives which required them (eg wccp_router) and use the magic
IP_ANYADDR value. This change makes configure halt with a FATAL error
instead.

 Detected by Coverity Scan. Issue 1057286.

src/cache_cf.cc

index e624b71b3bfcd4969ba92a0925290ab3692e2ee2..d8bd15923cbb96401bae3026840d3a2b5580900c 100644 (file)
@@ -1366,8 +1366,12 @@ parse_address(Ip::Address *addr)
         addr->SetNoAddr();
     else if ( (*addr = token) ) // try parse numeric/IPA
         (void) 0;
-    else
-        addr->GetHostByName(token); // dont use ipcache
+    else if (addr->GetHostByName(token)) // dont use ipcache
+        (void) 0;
+    else { // not an IP and not a hostname
+        debugs(3, DBG_CRITICAL, "FATAL: invalid IP address or domain name '" << token << "'");
+        self_destruct();
+    }
 }
 
 static void