aboutsummaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2017-11-22 02:01:51 +1100
committerteor <teor2345@gmail.com>2017-11-22 02:01:51 +1100
commitd7833c9d27feed9e4d4d4d4b5920b5d17150b82d (patch)
tree1b4ca25616377499e40638d444daa296ff442ef8 /src/or/entrynodes.c
parent690f646bf8a5de9b099fb5295ba9ff252e5606f4 (diff)
downloadtor-d7833c9d27feed9e4d4d4d4b5920b5d17150b82d.tar.gz
tor-d7833c9d27feed9e4d4d4d4b5920b5d17150b82d.zip
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.
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 826c0e48a0..100286f103 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)