From: wessels <> Date: Tue, 27 Aug 1996 23:55:34 +0000 (+0000) Subject: truncate long URLs X-Git-Tag: SQUID_3_0_PRE1~5903 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=774cc2d860bb56c80f997d7f41a23ed9d4e8a7a6;p=thirdparty%2Fsquid.git truncate long URLs --- diff --git a/src/url.cc b/src/url.cc index 12aebe6b88..bb01d93af6 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.29 1996/08/12 23:37:25 wessels Exp $ + * $Id: url.cc,v 1.30 1996/08/27 17:55:34 wessels Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -197,10 +197,13 @@ request_t *urlParse(method, url) char *t = NULL; int port; protocol_t protocol = PROTO_NONE; + int l; proto[0] = host[0] = urlpath[0] = login[0] = '\0'; - if (strlen(url) > MAX_URL) { - debug(23, 0, "urlParse: URL too large (%d bytes)\n", strlen(url)); + if ((l = strlen(url)) > MAX_URL) { + /* terminate so it doesn't overflow other buffers */ + *(url + (MAX_URL >> 1)) = '\0'; + debug(23, 0, "urlParse: URL too large (%d bytes)\n", l); return NULL; } if (method == METHOD_CONNECT) {