]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a crash when we load a bridge descriptor from disk but we don't
authorRoger Dingledine <arma@torproject.org>
Sat, 22 Dec 2007 06:11:49 +0000 (06:11 +0000)
committerRoger Dingledine <arma@torproject.org>
Sat, 22 Dec 2007 06:11:49 +0000 (06:11 +0000)
currently have a Bridge line for it in our torrc. Bugfix on
0.2.0.12-alpha.

svn:r12921

ChangeLog
src/or/circuitbuild.c
src/or/routerlist.c

index 4bc9c58adfd9343a0b6b33809de0cf4425d061e1..f25a5358122d43839a77aec852d4bac6c05ca5cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@ Changes in version 0.2.0.14-alpha - 2007-12-??
       time you use a given introduction point for your service, but
       on subsequent requests we'd be using garbage memory. Fixed by
       Karsten Loesing. Bugfix on 0.2.0.12-alpha.
+    - Fix a crash when we load a bridge descriptor from disk but we don't
+      currently have a Bridge line for it in our torrc. Bugfix on
+      0.2.0.12-alpha.
 
   o Minor bugfixes:
     - Make the unit tests build again.
index 424d2e1950b231c428c2edd1e8f6099fffd783e8..6ca23b9d51cde4c621587606d31fd894c8902f8f 100644 (file)
@@ -2908,6 +2908,7 @@ bridge_fetch_status_increment(bridge_info_t *bridge, time_t now)
 static void
 bridge_fetch_status_arrived(bridge_info_t *bridge, time_t now)
 {
+  tor_assert(bridge);
   bridge->fetch_status.next_attempt_at = now+60*60;
   bridge->fetch_status.n_download_failures = 0;
 }
@@ -3038,13 +3039,15 @@ learned_bridge_descriptor(routerinfo_t *ri)
     time_t now = time(NULL);
     ri->is_running = 1;
 
-    /* it's here; schedule its re-fetch for a long time from now. */
-    bridge_fetch_status_arrived(bridge, now);
+    if (bridge) { /* if we actually want to use this one */
+      /* it's here; schedule its re-fetch for a long time from now. */
+      bridge_fetch_status_arrived(bridge, now);
 
-    add_an_entry_guard(ri, 1);
-    log_notice(LD_DIR, "new bridge descriptor '%s'", ri->nickname);
-    if (first)
-      routerlist_retry_directory_downloads(now);
+      add_an_entry_guard(ri, 1);
+      log_notice(LD_DIR, "new bridge descriptor '%s'", ri->nickname);
+      if (first)
+        routerlist_retry_directory_downloads(now);
+    }
   }
 }
 
index de3e1e99c3bd9baa3ec1a96e5eadbb6ad3214590..0c56d440e3e1b836d001c4172c5f78c28982b122 100644 (file)
@@ -3050,8 +3050,8 @@ routerlist_remove_old_routers(void)
   digestmap_free(retain, NULL);
 }
 
-/** We just added a new descriptor that isn't of purpose
- * ROUTER_PURPOSE_GENERAL. Take whatever extra steps we need. */
+/** We just added a new set of descriptors. Take whatever extra steps
+ * we need. */
 static void
 routerlist_descriptors_added(smartlist_t *sl)
 {