]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1434: Fails to process long host names
authorserassio <>
Sun, 23 Apr 2006 15:02:13 +0000 (15:02 +0000)
committerserassio <>
Sun, 23 Apr 2006 15:02:13 +0000 (15:02 +0000)
Forward port of 2.5 changes.

include/rfc1035.h
include/util.h
src/internal.cc
src/squid.h
src/url.cc

index 6f21a288ec9e12ad9cb1b1d745c38c1ca94eeef9..11f7144775b898c1ba13de1b917fdcf4d57542ac 100644 (file)
@@ -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];
index e63811e4c5fe7fb1d22f1852cd98f6d6ade83520..0f502bca92a9181f8db05ed7e0a7726d9265a0a3 100644 (file)
@@ -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
  *
 #endif
 
 #if !defined(SQUIDHOSTNAMELEN)
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifndef _SQUID_MSWIN_
-#ifndef _SQUID_NETDB_H_                /* need protection on NEXTSTEP */
-#define _SQUID_NETDB_H_
-#include <netdb.h>
-#endif
-#endif
-#if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 128)
-#define SQUIDHOSTNAMELEN 128
-#else
-#define SQUIDHOSTNAMELEN MAXHOSTNAMELEN
-#endif
+#define SQUIDHOSTNAMELEN 256
 #endif
 
 #if defined(_SQUID_FREEBSD_)
index 1eb67af8aa90e7618c90a30c53535753d94042e8..937be9bdcb15384219074188409e5b7876cf9d7b 100644 (file)
@@ -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
index e1083f0e48862a673cca3bf42e54ac64d471b1ba..1f1928fba4977a4f43df24f581049dc352aecb5d 100644 (file)
@@ -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 <math.h>
 #endif
 
-#if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 128)
-#define SQUIDHOSTNAMELEN 128
-#else
-#define SQUIDHOSTNAMELEN MAXHOSTNAMELEN
-#endif
+#define SQUIDHOSTNAMELEN 256
 
 #define SQUID_MAXPATHLEN 256
 #ifndef MAXPATHLEN
index 77370fdeca2a0fbced01d660d7b7e4f2d288ea9f..4d91debdbdbdce8cf9b7cc11930d9f8e3618e2bc 100644 (file)
@@ -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);