]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
We weren't checking valid range on TCP port numbers. Certain port
authorwessels <>
Thu, 12 Sep 2002 11:19:47 +0000 (11:19 +0000)
committerwessels <>
Thu, 12 Sep 2002 11:19:47 +0000 (11:19 +0000)
numbers in a URL (http://192.168.0.12:-9999999999/) cause Squid to
assert in comm_connect_addr().  Reported by Joao Gouveia
( tharbad at kaotik dot org )

src/url.cc

index b7e3ca9239a4eb24a22ad8c05443c036920a930e..940d55bb468c1b4084b2b2ca2168dd07b32108a2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: url.cc,v 1.136 2002/08/24 01:54:34 hno Exp $
+ * $Id: url.cc,v 1.137 2002/09/12 05:19:47 wessels Exp $
  *
  * DEBUG: section 23    URL Parsing
  * AUTHOR: Duane Wessels
@@ -316,8 +316,8 @@ urlParse(method_t method, char *url)
        xmemmove(t, t + 1, strlen(t));
     if (Config.appendDomain && !strchr(host, '.'))
        strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN);
-    if (port == 0) {
-       debug(23, 3) ("urlParse: Invalid port == 0\n");
+    if (port < 1 || port > 65535) {
+       debug(23, 3) ("urlParse: Invalid port '%d'\n", port);
        return NULL;
     }
 #ifdef HARDCODE_DENY_PORTS