mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
fix naked memcmps
This commit is contained in:
+2
-2
@@ -2062,8 +2062,8 @@ routers_make_ed_keys_unique(smartlist_t *routers)
|
||||
const time_t ri2_pub = ri2->cache_info.published_on;
|
||||
if (ri2_pub < ri_pub ||
|
||||
(ri2_pub == ri_pub &&
|
||||
memcmp(ri->cache_info.signed_descriptor_digest,
|
||||
ri2->cache_info.signed_descriptor_digest,DIGEST_LEN)<0)) {
|
||||
fast_memcmp(ri->cache_info.signed_descriptor_digest,
|
||||
ri2->cache_info.signed_descriptor_digest,DIGEST_LEN)<0)) {
|
||||
digest256map_set(by_ed_key, pk, ri);
|
||||
ri2->omit_from_vote = 1;
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -2452,7 +2452,7 @@ get_bridge_dl_status_by_id, (const char *digest))
|
||||
|
||||
if (digest && get_options()->UseBridges && bridge_list) {
|
||||
SMARTLIST_FOREACH_BEGIN(bridge_list, bridge_info_t *, b) {
|
||||
if (memcmp(digest, b->identity, DIGEST_LEN) == 0) {
|
||||
if (tor_memeq(digest, b->identity, DIGEST_LEN)) {
|
||||
dl = &(b->fetch_status);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ dump_desc_fifo_bump_hash(const uint8_t *digest_sha256)
|
||||
/* Find a match if one exists */
|
||||
SMARTLIST_FOREACH_BEGIN(descs_dumped, dumped_desc_t *, ent) {
|
||||
if (ent &&
|
||||
memcmp(ent->digest_sha256, digest_sha256, DIGEST256_LEN) == 0) {
|
||||
tor_memeq(ent->digest_sha256, digest_sha256, DIGEST256_LEN)) {
|
||||
/*
|
||||
* Save a pointer to the match and remove it from its current
|
||||
* position.
|
||||
@@ -919,7 +919,7 @@ dump_desc_populate_one_file, (const char *dirname, const char *f))
|
||||
}
|
||||
|
||||
/* Compare the digests */
|
||||
if (memcmp(digest, content_digest, DIGEST256_LEN) != 0) {
|
||||
if (tor_memneq(digest, content_digest, DIGEST256_LEN)) {
|
||||
/* No match */
|
||||
log_info(LD_DIR,
|
||||
"Hash of %s from unparseable descriptors directory didn't "
|
||||
|
||||
Reference in New Issue
Block a user