]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't try to use confirmed_idx in remove_guard_from_...lists()
authorNick Mathewson <nickm@torproject.org>
Tue, 31 Jan 2017 19:34:32 +0000 (14:34 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 31 Jan 2017 19:34:32 +0000 (14:34 -0500)
Since we can call this function more than once before we update all
the confirmed_idx fields, we can't rely on all the relays having an
accurate confirmed_idx.

Fixes bug 21129; bugfix on 0.3.0.1-alpha

changes/bug21129 [new file with mode: 0644]
src/or/entrynodes.c

diff --git a/changes/bug21129 b/changes/bug21129
new file mode 100644 (file)
index 0000000..5a09bb4
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes (client, entry guards):
+    - Fix a spurious bug warning (with backtrace) when removing an
+      expired entry guard.  Fixes bug 21129; bugfix on 0.3.0.1-alpha.
+
index c5fb92e35a434a489814e4b6556e842510ed877d..30a1f4b83094d8e4b7376b200aea5a645a670abd 100644 (file)
@@ -1112,18 +1112,7 @@ remove_guard_from_confirmed_and_primary_lists(guard_selection_t *gs,
   }
 
   if (guard->confirmed_idx >= 0) {
-    entry_guard_t *found_guard = NULL;
-    if (guard->confirmed_idx < smartlist_len(gs->confirmed_entry_guards))
-      found_guard = smartlist_get(gs->confirmed_entry_guards,
-                                  guard->confirmed_idx);
-    if (BUG(guard != found_guard)) {
-      // LCOV_EXCL_START
-      smartlist_remove_keeporder(gs->confirmed_entry_guards, guard);
-      // LCOV_EXCL_STOP
-    } else {
-      smartlist_del_keeporder(gs->confirmed_entry_guards,
-                              guard->confirmed_idx);
-    }
+    smartlist_remove_keeporder(gs->confirmed_entry_guards, guard);
     guard->confirmed_idx = -1;
     guard->confirmed_on_date = 0;
   } else {