Explorar o código

Fix a crash on startup if you install Tor 0.2.0.13-alpha fresh
without a datadirectory from a previous Tor install. Reported
by Zax.


svn:r12928

Roger Dingledine %!s(int64=18) %!d(string=hai) anos
pai
achega
87a616e128
Modificáronse 2 ficheiros con 5 adicións e 0 borrados
  1. 3 0
      ChangeLog
  2. 2 0
      src/or/networkstatus.c

+ 3 - 0
ChangeLog

@@ -1,5 +1,8 @@
 Changes in version 0.2.0.14-alpha - 2007-12-??
 Changes in version 0.2.0.14-alpha - 2007-12-??
   o Major bugfixes:
   o Major bugfixes:
+    - Fix a crash on startup if you install Tor 0.2.0.13-alpha fresh
+      without a datadirectory from a previous Tor install. Reported
+      by Zax.
     - Fix a crash when we fetch a descriptor that turns out to be
     - Fix a crash when we fetch a descriptor that turns out to be
       unexpected (it used to be in our networkstatus when we started
       unexpected (it used to be in our networkstatus when we started
       fetching it, but it isn't in our current networkstatus), and we
       fetching it, but it isn't in our current networkstatus), and we

+ 2 - 0
src/or/networkstatus.c

@@ -127,6 +127,8 @@ router_reload_v2_networkstatus(void)
 
 
   entries = tor_listdir(filename);
   entries = tor_listdir(filename);
   tor_free(filename);
   tor_free(filename);
+  if (!entries) /* dir doesn't exist */
+    return 0;
   SMARTLIST_FOREACH(entries, const char *, fn, {
   SMARTLIST_FOREACH(entries, const char *, fn, {
       char buf[DIGEST_LEN];
       char buf[DIGEST_LEN];
       if (strlen(fn) != HEX_DIGEST_LEN ||
       if (strlen(fn) != HEX_DIGEST_LEN ||