From: wessels <> Date: Thu, 12 Sep 2002 11:19:47 +0000 (+0000) Subject: We weren't checking valid range on TCP port numbers. Certain port X-Git-Tag: SQUID_3_0_PRE1~762 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a1d4727a0329537035efdfc32c1b9b5c602e7cf;p=thirdparty%2Fsquid.git We weren't checking valid range on TCP port numbers. Certain port 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 ) --- diff --git a/src/url.cc b/src/url.cc index b7e3ca9239..940d55bb46 100644 --- a/src/url.cc +++ b/src/url.cc @@ -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