diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-05-12 19:27:18 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-05-12 19:27:18 -0400 |
commit | af85017177566a26d17076a256b3a4d5ae555170 (patch) | |
tree | e10d62291caa738067a23cfe2b43af4192575a13 /src/or/microdesc.c | |
parent | 696cd1cfe25e064ed3ceacf5ea5c7b18264873c6 (diff) | |
parent | 9e16a418f92670ae713138701fa931567fb4983d (diff) | |
download | tor-af85017177566a26d17076a256b3a4d5ae555170.tar.gz tor-af85017177566a26d17076a256b3a4d5ae555170.zip |
Merge remote-tracking branch 'public/bug3122_memcmp_023'
Diffstat (limited to 'src/or/microdesc.c')
-rw-r--r-- | src/or/microdesc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c index 664e8b74c1..7ebb1e14fd 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -55,7 +55,7 @@ _microdesc_hash(microdesc_t *md) static INLINE int _microdesc_eq(microdesc_t *a, microdesc_t *b) { - return !memcmp(a->digest, b->digest, DIGEST256_LEN); + return tor_memeq(a->digest, b->digest, DIGEST256_LEN); } HT_PROTOTYPE(microdesc_map, microdesc_t, node, @@ -466,7 +466,7 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force) tor_assert(md->saved_location == SAVED_IN_CACHE); md->body = (char*)cache->cache_content->data + md->off; if (PREDICT_UNLIKELY( - md->bodylen < 9 || memcmp(md->body, "onion-key", 9) != 0)) { + md->bodylen < 9 || fast_memneq(md->body, "onion-key", 9) != 0)) { /* XXXX023 once bug 2022 is solved, we can kill this block and turn it * into just the tor_assert(!memcmp) */ off_t avail = cache->cache_content->size - md->off; @@ -478,7 +478,7 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force) " with \"onion-key\". Instead I got %s.", (int)md->off, escaped(bad_str)); tor_free(bad_str); - tor_assert(!memcmp(md->body, "onion-key", 9)); + tor_assert(fast_memeq(md->body, "onion-key", 9)); } } SMARTLIST_FOREACH_END(md); |