Explorar o código

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
teor %!s(int64=6) %!d(string=hai) anos
pai
achega
033691212a
Modificáronse 2 ficheiros con 7 adicións e 1 borrados
  1. 4 0
      changes/bug23524
  2. 3 1
      src/or/bridges.c

+ 4 - 0
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.

+ 3 - 1
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;