[tor-commits] [tor/master] Use fast check for missing id in node_is_a_configured_bridge()

asn at torproject.org asn at torproject.org
Tue Apr 30 16:18:52 UTC 2019


commit 806539b40a18dec15e1d3d108eb5aec9d9f3ca40
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Apr 26 11:19:46 2019 -0400

    Use fast check for missing id in node_is_a_configured_bridge()
    
    Fixes bug 30308; bugfix on 0.3.5.1-alpha.
---
 changes/ticket30308          | 5 +++++
 src/feature/client/bridges.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/changes/ticket30308 b/changes/ticket30308
new file mode 100644
index 000000000..b78e6b3e9
--- /dev/null
+++ b/changes/ticket30308
@@ -0,0 +1,5 @@
+  o Minor bugfixes (performance):
+    - When checking a node for bridge status, use a fast check to make sure
+      that its identity is set. Previously, we used a constant-time check,
+      which is not necessary when verifying a BUG() condition that causes
+      a stack trace. Fixes bug 30308; bugfix on 0.3.5.1-alpha.
diff --git a/src/feature/client/bridges.c b/src/feature/client/bridges.c
index 05f89ad36..ea1aff951 100644
--- a/src/feature/client/bridges.c
+++ b/src/feature/client/bridges.c
@@ -348,7 +348,7 @@ int
 node_is_a_configured_bridge(const node_t *node)
 {
   /* First, let's try searching for a bridge with matching identity. */
-  if (BUG(tor_digest_is_zero(node->identity)))
+  if (BUG(tor_mem_is_zero(node->identity, DIGEST_LEN)))
     return 0;
 
   if (find_bridge_by_digest(node->identity) != NULL)





More information about the tor-commits mailing list