]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix off-by-one errors in rev.14139
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 9 Jul 2015 02:21:52 +0000 (19:21 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 9 Jul 2015 02:21:52 +0000 (19:21 -0700)
src/client_side.cc
src/gopher.cc

index 739cffae53431b0d163554b69be757e7d1492202..2c03b56218b42805c123cd279a0c763f8fad5483 100644 (file)
@@ -2240,7 +2240,7 @@ parseHttpRequest(ConnStateData *csd, const Http1::RequestParserPointer &hp)
          * requested url. may be rewritten later, so make extra room */
         int url_sz = hp->requestUri().length() + Config.appendDomainLen + 5;
         http->uri = (char *)xcalloc(url_sz, 1);
-        xstrncpy(http->uri, hp->requestUri().rawContent(), hp->requestUri().length());
+        xstrncpy(http->uri, hp->requestUri().rawContent(), hp->requestUri().length()+1);
     }
 
     result->flags.parsed_ok = 1;
index 0347d2dae1b4ed56fe0e313be6518859bfe849a6..27e569ea5438e6c75fdbe31c5f1f83c5328be4ec 100644 (file)
@@ -273,8 +273,8 @@ gopher_request_parse(const HttpRequest * req, char *type_id, char *request)
     *type_id = typeId[0];
 
     if (request) {
-        SBuf path = tok.remaining().substr(0, MAX_URL);
-        xstrncpy(request, path.rawContent(), path.length());
+        SBuf path = tok.remaining().substr(0, MAX_URL-1);
+        xstrncpy(request, path.rawContent(), path.length()+1);
         /* convert %xx to char */
         rfc1738_unescape(request);
     }