]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
truncate long URLs
authorwessels <>
Tue, 27 Aug 1996 23:55:34 +0000 (23:55 +0000)
committerwessels <>
Tue, 27 Aug 1996 23:55:34 +0000 (23:55 +0000)
src/url.cc

index 12aebe6b8884876acaf7899663ad236806e89795..bb01d93af6716c85076c2265c86e66d0ca3b3630 100644 (file)
@@ -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) {