]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
MemBuf fix: empty MemBufs are not NULL terminated
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Wed, 9 Apr 2014 16:56:54 +0000 (09:56 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 9 Apr 2014 16:56:54 +0000 (09:56 -0700)
This is may cause problems in some cases where the code assume that the MemBuf
is always NULL terminated. For example when an ErrorState object try to use
an empty errorpage template.

This patch terminates the (empty) MemBuf on MemBuf::init method.

src/MemBuf.cc

index 222fe3f24bbba936c69cf066e223bb24d4cdfee2..99fab208529f61a6a9807c6f44b5f21912dbcae4 100644 (file)
@@ -137,6 +137,7 @@ MemBuf::init(mb_size_t szInit, mb_size_t szMax)
     capacity = 0;
     stolen = 0;
     grow(szInit);
+    terminate();
 }
 
 /**