From: hno <> Date: Sun, 5 Nov 2006 00:10:43 +0000 (+0000) Subject: Bug #1799: Harmless 1 byte buffer overflow on long hostnames in /etc/hosts X-Git-Tag: SQUID_3_0_PRE5~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fbd26b519be48ca5760942084743d8fb188c8b2;p=thirdparty%2Fsquid.git Bug #1799: Harmless 1 byte buffer overflow on long hostnames in /etc/hosts --- diff --git a/src/tools.cc b/src/tools.cc index 30fffb5346..4e81a13f48 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.271 2006/09/13 18:55:10 serassio Exp $ + * $Id: tools.cc,v 1.272 2006/11/04 17:10:43 hno Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -1206,7 +1206,7 @@ parseEtcHosts(void) if (Config.appendDomain && !strchr(lt, '.')) { /* I know it's ugly, but it's only at reconfig */ strncpy(buf2, lt, 512); - strncat(buf2, Config.appendDomain, 512 - strlen(lt)); + strncat(buf2, Config.appendDomain, 512 - strlen(lt) - 1); host = buf2; } else { host = lt;