]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: fix assertion in Store unit tests
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 29 Aug 2015 18:51:19 +0000 (11:51 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 29 Aug 2015 18:51:19 +0000 (11:51 -0700)
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

index e8f010b54f58057a8bb70adbed6a14751f983501..7736d53254a9ae5442258390ef4cdf316cbebd03 100644 (file)
@@ -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);
     }
 };