From d3da4d1a354b6c01ed1aa4a6d2536d6011ecf3ab Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 21 Aug 2015 02:43:53 -0700 Subject: [PATCH] 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. --- src/tests/CapturingStoreEntry.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tests/CapturingStoreEntry.h b/src/tests/CapturingStoreEntry.h index 486ba5d7ba..e263e99d88 100644 --- a/src/tests/CapturingStoreEntry.h +++ b/src/tests/CapturingStoreEntry.h @@ -33,6 +33,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); } }; -- 2.47.2