From: serassio <> Date: Sun, 23 Apr 2006 15:02:13 +0000 (+0000) Subject: Bug #1434: Fails to process long host names X-Git-Tag: SQUID_3_0_PRE4~246 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c8918a584c4f0c156e4b0d8b11721ecf9e8a2f57;p=thirdparty%2Fsquid.git Bug #1434: Fails to process long host names Forward port of 2.5 changes. --- diff --git a/include/rfc1035.h b/include/rfc1035.h index 6f21a288ec..11f7144775 100644 --- a/include/rfc1035.h +++ b/include/rfc1035.h @@ -1,5 +1,5 @@ /* - * $Id: rfc1035.h,v 1.16 2005/10/23 14:10:45 serassio Exp $ + * $Id: rfc1035.h,v 1.17 2006/04/23 09:02:13 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -46,7 +46,7 @@ #endif /* rfc1035 - DNS */ -#define RFC1035_MAXHOSTNAMESZ 250 +#define RFC1035_MAXHOSTNAMESZ 256 typedef struct _rfc1035_rr rfc1035_rr; struct _rfc1035_rr { char name[RFC1035_MAXHOSTNAMESZ]; diff --git a/include/util.h b/include/util.h index e63811e4c5..0f502bca92 100644 --- a/include/util.h +++ b/include/util.h @@ -1,5 +1,5 @@ /* - * $Id: util.h,v 1.72 2005/04/18 21:52:40 hno Exp $ + * $Id: util.h,v 1.73 2006/04/23 09:02:13 serassio Exp $ * * AUTHOR: Harvest Derived * @@ -45,20 +45,7 @@ #endif #if !defined(SQUIDHOSTNAMELEN) -#if HAVE_SYS_PARAM_H -#include -#endif -#ifndef _SQUID_MSWIN_ -#ifndef _SQUID_NETDB_H_ /* need protection on NEXTSTEP */ -#define _SQUID_NETDB_H_ -#include -#endif -#endif -#if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 128) -#define SQUIDHOSTNAMELEN 128 -#else -#define SQUIDHOSTNAMELEN MAXHOSTNAMELEN -#endif +#define SQUIDHOSTNAMELEN 256 #endif #if defined(_SQUID_FREEBSD_) diff --git a/src/internal.cc b/src/internal.cc index 1eb67af8aa..937be9bdcb 100644 --- a/src/internal.cc +++ b/src/internal.cc @@ -1,6 +1,6 @@ /* - * $Id: internal.cc,v 1.37 2006/02/17 20:15:35 wessels Exp $ + * $Id: internal.cc,v 1.38 2006/04/23 09:02:13 serassio Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -103,7 +103,7 @@ internalRemoteUri(const char *host, u_short port, const char *dir, const char *n static char lc_host[SQUIDHOSTNAMELEN]; assert(host && name); /* convert host name to lower case */ - xstrncpy(lc_host, host, SQUIDHOSTNAMELEN - 1); + xstrncpy(lc_host, host, SQUIDHOSTNAMELEN); Tolower(lc_host); /* * append the domain in order to mirror the requests with appended diff --git a/src/squid.h b/src/squid.h index e1083f0e48..1f1928fba4 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.249 2006/04/22 05:29:20 robertc Exp $ + * $Id: squid.h,v 1.250 2006/04/23 09:02:13 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -224,11 +224,7 @@ extern void xassert(const char *, const char *, int); #include #endif -#if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 128) -#define SQUIDHOSTNAMELEN 128 -#else -#define SQUIDHOSTNAMELEN MAXHOSTNAMELEN -#endif +#define SQUIDHOSTNAMELEN 256 #define SQUID_MAXPATHLEN 256 #ifndef MAXPATHLEN diff --git a/src/url.cc b/src/url.cc index 77370fdeca..4d91debdbd 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.150 2006/01/19 18:50:36 wessels Exp $ + * $Id: url.cc,v 1.151 2006/04/23 09:02:13 serassio Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -406,7 +406,7 @@ urlParse(method_t method, char *url, HttpRequest *request) #endif if (Config.appendDomain && !strchr(host, '.')) - strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN); + strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN - strlen(host) - 1); if (port < 1 || port > 65535) { debug(23, 3) ("urlParse: Invalid port '%d'\n", port);