From fd89e819c95f91ac13cc2a098072731f9313f893 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 29 Aug 2015 11:51:19 -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 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); } }; -- 2.47.2