]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Drop excess bytes from gopher input.
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 26 Aug 2011 17:47:07 +0000 (05:47 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 26 Aug 2011 17:47:07 +0000 (05:47 +1200)
src/gopher.cc

index a83991dcddc2f317fdf632febd10b0c70735aa2a..11bec54e6ac2dea831e983458c7b0c6338534643 100644 (file)
@@ -484,6 +484,11 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
             *(gopherState->buf) = '\0';
         } else {
 
+            if ((len - (pos - inbuf)) > TEMP_BUF_SIZE) {
+                debugs(10, 1, "GopherHTML: Buffer overflow. Lost some data on URL: " << entry->url());
+                len = TEMP_BUF_SIZE;
+            }
+
             lpos = (char *) memccpy(line, pos, '\n', len - (pos - inbuf));
 
             if (lpos)