From: Amos Jeffries Date: Fri, 30 Oct 2015 12:59:17 +0000 (-0700) Subject: Add Locker friend class to SBuf for protection against memory issues X-Git-Tag: SQUID_4_0_2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=39441513efc377f3db64e763667a93c1a6d12862;p=thirdparty%2Fsquid.git Add Locker friend class to SBuf for protection against memory issues When appending or otherwise modifying an SBuf based on a SBuf& or char* the parameter used may be pointing at the MemBlob memory buffer indirectly without holding a separate ref-count lock to it. If 'this' SBuf then requires reallocation for any reason the char* or buffer pointer taken from the SBuf&, which is being manipulated may in fact be left pointing at invalid memory. Utilize a private Locker class to create relatively cheap ref-count locks on the store_ MemBlob when this problem MAY occur. This Locker needs to be used on all non-const SBuf methods accepting char* or SBuf& argument. --- 39441513efc377f3db64e763667a93c1a6d12862