From: Amos Jeffries Date: Fri, 26 Aug 2011 17:47:07 +0000 (+1200) Subject: Drop excess bytes from gopher input. X-Git-Tag: take08~35^2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f2491587f7f59f7d5a6b2897bef1224e111bfd4b;p=thirdparty%2Fsquid.git Drop excess bytes from gopher input. --- diff --git a/src/gopher.cc b/src/gopher.cc index a83991dcdd..11bec54e6a 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -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)