From 5595b212270215eaa020603cabbe2c7b3b34d624 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 11 Sep 2018 09:38:20 -0400 Subject: Consdiff: use lengths on inputs so they don't need NUL at the end This is part of #27244, so that we can safely mmap consensus documents. --- src/test/bench.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/test/bench.c') diff --git a/src/test/bench.c b/src/test/bench.c index 959d4374b1..9da1b46a1b 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -702,11 +702,13 @@ main(int argc, const char **argv) perror("X"); return 1; } + size_t f1len = strlen(f1); + size_t f2len = strlen(f2); for (i = 0; i < N; ++i) { - char *diff = consensus_diff_generate(f1, f2); + char *diff = consensus_diff_generate(f1, f1len, f2, f2len); tor_free(diff); } - char *diff = consensus_diff_generate(f1, f2); + char *diff = consensus_diff_generate(f1, f1len, f2, f2len); printf("%s", diff); tor_free(f1); tor_free(f2); -- cgit v1.2.3-54-g00ecf