From: Amos Jeffries Date: Mon, 18 Apr 2011 12:01:28 +0000 (-0600) Subject: Bug 3183: Invalid URL accepted with url host part of only '@'. X-Git-Tag: SQUID_3_1_12_1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=089d4d2852b56f80e46491d4d11580ec23bb1fb3;p=thirdparty%2Fsquid.git Bug 3183: Invalid URL accepted with url host part of only '@'. 3.0 results in an ICAP segfault handling these URLs. Newer releases do not segfault as easily, but still accept the invalid URL and there may be other unknown side-effects. Makes the URL parser present ERR_INVALID_URL for this edge case. --- diff --git a/src/url.cc b/src/url.cc index 2f69f9a836..8300578a88 100644 --- a/src/url.cc +++ b/src/url.cc @@ -325,6 +325,12 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest *request) } } + // Bug 3183 sanity check: If scheme is present, host must be too. + if (protocol != AnyP::PROTO_NONE && (host == NULL || *host == '\0')) { + debugs(23, DBG_IMPORTANT, "SECURITY WARNING: Missing hostname in URL '" << url << "'. see access.log for details."); + return NULL; + } + if (t && *t == ':') { *t = '\0'; t++;