[or-cvs] r17558: {tor} Backport karsten's bug 885 fix. (in tor/branches/tor-0_2_0-patches: . src/or)

nickm at seul.org nickm at seul.org
Wed Dec 10 15:50:05 UTC 2008


Author: nickm
Date: 2008-12-10 10:50:04 -0500 (Wed, 10 Dec 2008)
New Revision: 17558

Modified:
   tor/branches/tor-0_2_0-patches/ChangeLog
   tor/branches/tor-0_2_0-patches/src/or/routerlist.c
Log:
Backport karsten's bug 885 fix.

Modified: tor/branches/tor-0_2_0-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_2_0-patches/ChangeLog	2008-12-10 15:48:47 UTC (rev 17557)
+++ tor/branches/tor-0_2_0-patches/ChangeLog	2008-12-10 15:50:04 UTC (rev 17558)
@@ -10,11 +10,16 @@
     - Correct handling of possible malformed authority signing key
       certificates with internal signature types.  Fixes bug 880.
       Bugfix on 0.2.0.3-alpha.
+    - Fix a hard-to-trigger resource leak when logging credential status.
+      CID 349.
 
   o Minor features:
     - Report the case where all signatures in a detached set are rejected
       differently than the case where there is an error handling the detached
       set.
+    - When we realize that another process has modified our cached
+      descriptors, print out a more useful error message rather than
+      triggering an assertion. Fixes bug 885.  Patch from Karsten.
 
 
 Changes in version 0.2.0.32 - 2008-11-20

Modified: tor/branches/tor-0_2_0-patches/src/or/routerlist.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/routerlist.c	2008-12-10 15:48:47 UTC (rev 17557)
+++ tor/branches/tor-0_2_0-patches/src/or/routerlist.c	2008-12-10 15:50:04 UTC (rev 17558)
@@ -2084,6 +2084,11 @@
     if (store && store->mmap) {
       tor_assert(desc->saved_offset + len <= store->mmap->size);
       r = store->mmap->data + offset;
+    } else if (store) {
+      log_err(LD_DIR, "We couldn't read a descriptor that is supposedly "
+              "mmaped in our cache.  Is another process running in our data "
+              "directory?  Exiting.");
+      exit(1);
     }
   }
   if (!r) /* no mmap, or not in cache. */
@@ -2094,11 +2099,11 @@
   if (!with_annotations) {
     if (memcmp("router ", r, 7) && memcmp("extra-info ", r, 11)) {
       char *cp = tor_strndup(r, 64);
-      log_err(LD_DIR, "descriptor at %p begins with unexpected string %s",
+      log_err(LD_DIR, "descriptor at %p begins with unexpected string %s.  "
+              "Is another process running in our data directory?  Exiting.",
               desc, escaped(cp));
-      tor_free(cp);
+      exit(1);
     }
-    tor_assert(!memcmp("router ", r, 7) || !memcmp("extra-info ", r, 11));
   }
 
   return r;



More information about the tor-commits mailing list