aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dircache/consdiffmgr.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-11 09:38:20 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-11 11:16:50 -0400
commit5595b212270215eaa020603cabbe2c7b3b34d624 (patch)
tree1ea7bd05f23d00a7f09c7b769fbd350ba36880f7 /src/feature/dircache/consdiffmgr.c
parente5601f14ed4384e8de1030d21cc7442df48adabe (diff)
downloadtor-5595b212270215eaa020603cabbe2c7b3b34d624.tar.gz
tor-5595b212270215eaa020603cabbe2c7b3b34d624.zip
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.
Diffstat (limited to 'src/feature/dircache/consdiffmgr.c')
-rw-r--r--src/feature/dircache/consdiffmgr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/feature/dircache/consdiffmgr.c b/src/feature/dircache/consdiffmgr.c
index 304b64f3b6..7999df08d5 100644
--- a/src/feature/dircache/consdiffmgr.c
+++ b/src/feature/dircache/consdiffmgr.c
@@ -1496,7 +1496,10 @@ consensus_diff_worker_threadfn(void *state_, void *work_)
// XXXX ugh; this is going to calculate the SHA3 of both its
// XXXX inputs again, even though we already have that. Maybe it's time
// XXXX to change the API here?
- consensus_diff = consensus_diff_generate(diff_from_nt, diff_to_nt);
+ consensus_diff = consensus_diff_generate(diff_from_nt,
+ strlen(diff_from_nt),
+ diff_to_nt,
+ strlen(diff_to_nt));
tor_free(diff_from_nt);
tor_free(diff_to_nt);
}
@@ -1746,8 +1749,8 @@ consensus_compress_worker_threadfn(void *state_, void *work_)
(const uint8_t *)consensus, bodylen);
{
const char *start, *end;
- if (router_get_networkstatus_v3_signed_boundaries(consensus,
- &start, &end) < 0) {
+ if (router_get_networkstatus_v3_signed_boundaries(consensus, bodylen,
+ &start, &end) < 0) {
start = consensus;
end = consensus+bodylen;
}