[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Make an assert into a BUG warning in the bridge code



commit 033691212a49d3d32f8a684a493c8c11b8887eee
Author: teor <teor2345@xxxxxxxxx>
Date:   Fri Sep 15 14:02:22 2017 +1000

    Make an assert into a BUG warning in the bridge code
    
    If future code asks if there are any running bridges, without checking
    if bridges are enabled, log a BUG warning rather than crashing.
    
    Fixes 23524 on 0.3.0.1-alpha
---
 changes/bug23524 | 4 ++++
 src/or/bridges.c | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/changes/bug23524 b/changes/bug23524
new file mode 100644
index 000000000..c8ece5293
--- /dev/null
+++ b/changes/bug23524
@@ -0,0 +1,4 @@
+  o Minor bugfixes (DoS-resistance):
+    - If future code asks if there are any running bridges, without checking
+      if bridges are enabled, log a BUG warning rather than crashing.
+      Fixes 23524 on 0.3.0.1-alpha.
diff --git a/src/or/bridges.c b/src/or/bridges.c
index 812b0ddce..1eec4e39e 100644
--- a/src/or/bridges.c
+++ b/src/or/bridges.c
@@ -836,7 +836,9 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
 MOCK_IMPL(int,
 any_bridge_descriptors_known, (void))
 {
-  tor_assert(get_options()->UseBridges);
+  if (BUG(!get_options()->UseBridges)) {
+    return 0;
+  }
 
   if (!bridge_list)
     return 0;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits