Merge pull request #1880 from kadler/fix-hash-benchmark

Fix buffer overread in hash_collision_benchmark.cc
This commit is contained in:
Jan Niklas Hasse 2020-11-14 00:31:45 +01:00 committed by GitHub
commit a0b56413e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,9 +27,10 @@ int random(int low, int high) {
void RandomCommand(char** s) {
int len = random(5, 100);
*s = new char[len];
*s = new char[len+1];
for (int i = 0; i < len; ++i)
(*s)[i] = (char)random(32, 127);
(*s)[len] = '\0';
}
int main() {