]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Alex Rousskov <rousskov@measurement-factory.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 6 Jul 2009 01:51:39 +0000 (13:51 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 6 Jul 2009 01:51:39 +0000 (13:51 +1200)
Bug 2659: 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 5fa2e5c3a5812344179c447dcc735f0ae1add0f1..d1edf6164c92abcee81f2774af1e9e424503deb3 100644 (file)
@@ -173,6 +173,7 @@ String::append(const char *str, int len)
         len_ += len;
     } else {
         String snew;
+        assert(len_ + len < 65536); // otherwise snew.len_ overflows below
         snew.len_ = len_ + len;
         snew.initBuf(snew.len_ + 1);