]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
parseEtcHosts() does not properly handle comments. It looks for comments
authorwessels <>
Mon, 23 Jun 2003 06:41:31 +0000 (06:41 +0000)
committerwessels <>
Mon, 23 Jun 2003 06:41:31 +0000 (06:41 +0000)
(#) only at the beginning of the line, but they can appear anywhere.
This fix uses strtok() to terminate the buffer at the first comment
character.

src/tools.cc

index 4c3a938244d945bac6981f666158cc163550b6d0..0fe906c9e27922e89657b45ea192736a56c9f7f5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.236 2003/04/29 16:08:19 hno Exp $
+ * $Id: tools.cc,v 1.237 2003/06/23 00:41:31 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -1182,8 +1182,7 @@ parseEtcHosts(void)
         wordlist *hosts = NULL;
         char *addr;
 
-        if (buf[0] == '#')     /* MS-windows likes to add comments */
-            continue;
+        strtok(buf, "#");      /* chop everything following a comment marker */
 
         lt = buf;