summaryrefslogtreecommitdiff
path: root/src/or/hs_common.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-08-07 18:58:13 +0300
committerNick Mathewson <nickm@torproject.org>2017-08-08 20:29:35 -0400
commit101ce6da01770ba0d05291ccafb98c4274cb616e (patch)
tree49b58808eb8a59d40ff86c9e984a686255796c14 /src/or/hs_common.c
parent8bac50d7559adba16e282d5c83b891a387a8a3d5 (diff)
downloadtor-101ce6da01770ba0d05291ccafb98c4274cb616e.tar.gz
tor-101ce6da01770ba0d05291ccafb98c4274cb616e.zip
Fix the build_hs_index() function.
Also add a unittest for hs_get_responsible_hsdirs() which was used to find and fix the bug.
Diffstat (limited to 'src/or/hs_common.c')
-rw-r--r--src/or/hs_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index f5c63cb6a0..62cda34bd6 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -1004,9 +1004,9 @@ hs_build_hs_index(uint64_t replica, const ed25519_public_key_t *blinded_pk,
size_t offset = 0;
set_uint64(buf, tor_htonll(replica));
offset += sizeof(uint64_t);
- set_uint64(buf, tor_htonll(period_length));
+ set_uint64(buf+offset, tor_htonll(period_length));
offset += sizeof(uint64_t);
- set_uint64(buf, tor_htonll(period_num));
+ set_uint64(buf+offset, tor_htonll(period_num));
offset += sizeof(uint64_t);
tor_assert(offset == sizeof(buf));