From: wessels <> Date: Mon, 23 Jun 2003 06:41:31 +0000 (+0000) Subject: parseEtcHosts() does not properly handle comments. It looks for comments X-Git-Tag: SQUID_3_0_PRE1~96 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7a10c3151021a8b2adf0c311c0bb87260f32103c;p=thirdparty%2Fsquid.git parseEtcHosts() does not properly handle comments. It looks for comments (#) 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. --- diff --git a/src/tools.cc b/src/tools.cc index 4c3a938244..0fe906c9e2 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -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;