From 774cc2d860bb56c80f997d7f41a23ed9d4e8a7a6 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Tue, 27 Aug 1996 23:55:34 +0000 Subject: [PATCH] truncate long URLs --- src/url.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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) { -- 2.47.3