]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Alex Rousskov <rousskov@measurement-factory.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 2 Jul 2009 12:02:35 +0000 (00:02 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 2 Jul 2009 12:02:35 +0000 (00:02 +1200)
Bug 2695: String length overflows on append, leading to segfaults

Long-term patch for 3.0. This softens the error, but does not
resolve the issue completely for ESI.

Short-term patch for 3.1. The limit is arbitrary and may be fixed
at some point by a better patch. This one will work however.

src/String.cc

index a68af96883678c127e4e1f1c6ec002c5c932b6ec..9fc2ad80a463a445406b05b8ddddf469e5db878f 100644 (file)
@@ -193,6 +193,7 @@ String::append(const char *str, int len)
     } else {
         // Create a temporary string and absorb it later.
         String snew;
+        assert(len_ + len < 65536); // otherwise snew.len_ overflows below
         snew.len_ = len_ + len;
         snew.allocBuffer(snew.len_ + 1);