[or-cvs] r12921: Fix a crash when we load a bridge descriptor from disk but w (in tor/trunk: . src/or)

arma at seul.org arma at seul.org
Sat Dec 22 06:11:49 UTC 2007


Author: arma
Date: 2007-12-22 01:11:49 -0500 (Sat, 22 Dec 2007)
New Revision: 12921

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/circuitbuild.c
   tor/trunk/src/or/routerlist.c
Log:
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.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-12-22 06:11:29 UTC (rev 12920)
+++ tor/trunk/ChangeLog	2007-12-22 06:11:49 UTC (rev 12921)
@@ -8,6 +8,9 @@
       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.

Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2007-12-22 06:11:29 UTC (rev 12920)
+++ tor/trunk/src/or/circuitbuild.c	2007-12-22 06:11:49 UTC (rev 12921)
@@ -2908,6 +2908,7 @@
 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 @@
     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);
+    }
   }
 }
 

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-12-22 06:11:29 UTC (rev 12920)
+++ tor/trunk/src/or/routerlist.c	2007-12-22 06:11:49 UTC (rev 12921)
@@ -3050,8 +3050,8 @@
   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)
 {



More information about the tor-commits mailing list