[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/maint-0.3.2] Avoid crashing if we call num_usable_bridges() when bridges are not enabled
commit d7833c9d27feed9e4d4d4d4b5920b5d17150b82d
Author: teor <teor2345@xxxxxxxxx>
Date: Wed Nov 22 02:01:51 2017 +1100
Avoid crashing if we call num_usable_bridges() when bridges are not enabled
This applies the changes in 23524 to num_usable_bridges(), because it has
replaced any_bridge_descriptors_known().
The original changes file still applies.
---
src/or/entrynodes.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 826c0e48a..100286f10 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -3145,9 +3145,13 @@ num_bridges_usable,(void))
{
int n_options = 0;
- tor_assert(get_options()->UseBridges);
+ if (BUG(!get_options()->UseBridges)) {
+ return 0;
+ }
guard_selection_t *gs = get_guard_selection_info();
- tor_assert(gs->type == GS_TYPE_BRIDGE);
+ if (BUG(gs->type != GS_TYPE_BRIDGE)) {
+ return 0;
+ }
SMARTLIST_FOREACH_BEGIN(gs->sampled_entry_guards, entry_guard_t *, guard) {
if (guard->is_reachable == GUARD_REACHABLE_NO)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits