aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-05-23 10:45:13 -0400
committerNick Mathewson <nickm@torproject.org>2016-05-23 10:45:13 -0400
commit2a884926c04959b11c39e656099f19a55c3a8e95 (patch)
tree68bcffc586651926f8536fb869860afa8173208a /src/or
parent9c7edb0f3edd2dec30f10e195f7bcc12a4005f30 (diff)
parent50ff24e27652b4781a127d5dea81c4de96a6fdef (diff)
downloadtor-2a884926c04959b11c39e656099f19a55c3a8e95.tar.gz
tor-2a884926c04959b11c39e656099f19a55c3a8e95.zip
Merge remote-tracking branch 'dgoulet/bug19066_029_01'
Diffstat (limited to 'src/or')
-rw-r--r--src/or/routerparse.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 95c241d10d..42b05835ad 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -3508,7 +3508,7 @@ networkstatus_parse_detached_signatures(const char *s, const char *eos)
digest_algorithm_t alg;
const char *flavor;
const char *hexdigest;
- size_t expected_length;
+ size_t expected_length, digest_length;
tok = _tok;
@@ -3533,6 +3533,8 @@ networkstatus_parse_detached_signatures(const char *s, const char *eos)
expected_length =
(alg == DIGEST_SHA1) ? HEX_DIGEST_LEN : HEX_DIGEST256_LEN;
+ digest_length =
+ (alg == DIGEST_SHA1) ? DIGEST_LEN : DIGEST256_LEN;
if (strlen(hexdigest) != expected_length) {
log_warn(LD_DIR, "Wrong length on consensus-digest in detached "
@@ -3541,12 +3543,12 @@ networkstatus_parse_detached_signatures(const char *s, const char *eos)
}
digests = detached_get_digests(sigs, flavor);
tor_assert(digests);
- if (!tor_mem_is_zero(digests->d[alg], DIGEST256_LEN)) {
+ if (!tor_mem_is_zero(digests->d[alg], digest_length)) {
log_warn(LD_DIR, "Multiple digests for %s with %s on detached "
"signatures document", flavor, algname);
continue;
}
- if (base16_decode(digests->d[alg], DIGEST256_LEN,
+ if (base16_decode(digests->d[alg], digest_length,
hexdigest, strlen(hexdigest)) < 0) {
log_warn(LD_DIR, "Bad encoding on consensus-digest in detached "
"networkstatus signatures");