From: Amos Jeffries Date: Sat, 29 Aug 2015 18:51:19 +0000 (-0700) Subject: Cleanup: fix assertion in Store unit tests X-Git-Tag: SQUID_3_5_8~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd89e819c95f91ac13cc2a098072731f9313f893;p=thirdparty%2Fsquid.git Cleanup: fix assertion in Store unit tests The old Squid String implementation cannot handle appending nullptr or negative lengths. So if the test code using CapturingStoreEntry ever tries to append such it will crash instead of working like a StoreEntry should. --- diff --git a/src/tests/CapturingStoreEntry.h b/src/tests/CapturingStoreEntry.h index e8f010b54f..7736d53254 100644 --- a/src/tests/CapturingStoreEntry.h +++ b/src/tests/CapturingStoreEntry.h @@ -35,6 +35,8 @@ public: } virtual void append(char const * buf, int len) { + if (!buf || len < 0) // old 'String' can't handle these cases + return; _appended_text.append(buf, len); } };