From: Christos Tsantilas Date: Wed, 9 Apr 2014 16:56:54 +0000 (-0700) Subject: MemBuf fix: empty MemBufs are not NULL terminated X-Git-Tag: SQUID_3_4_4_1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e9dfe6671306d7fed19c44f1b378bee80978f24;p=thirdparty%2Fsquid.git MemBuf fix: empty MemBufs are not NULL terminated 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. --- diff --git a/src/MemBuf.cc b/src/MemBuf.cc index 222fe3f24b..99fab20852 100644 --- a/src/MemBuf.cc +++ b/src/MemBuf.cc @@ -137,6 +137,7 @@ MemBuf::init(mb_size_t szInit, mb_size_t szMax) capacity = 0; stolen = 0; grow(szInit); + terminate(); } /**