[or-cvs] r19094: {tor} fix from lark: make memarea_strndup() work even at the end o (in tor/trunk: . src/common)

nickm at seul.org nickm at seul.org
Sat Mar 21 11:52:54 UTC 2009


Author: nickm
Date: 2009-03-21 07:52:53 -0400 (Sat, 21 Mar 2009)
New Revision: 19094

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/common/memarea.c
Log:
fix from lark: make memarea_strndup() work even at the end of a mmap chunk.  Bug was harmless for now, I think.

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2009-03-21 10:55:16 UTC (rev 19093)
+++ tor/trunk/ChangeLog	2009-03-21 11:52:53 UTC (rev 19094)
@@ -12,6 +12,10 @@
       0.2.0.33.
     - Avoid double-free on list of successfully uploaded hidden
       service discriptors.  Fix for bug 948.  Bugfix on 0.2.1.6-alpha.
+    - Change memarea_strndup() implementation to work even when
+      duplicating a string at the end of a page.  This bug was
+      harmless for now, but could have meant crashes later. Fix by
+      lark.  Bugfix on 0.2.1.1-alpha.
 
   o Minor features (controller):
     - Try harder to look up nicknames for routers on a circuit when

Modified: tor/trunk/src/common/memarea.c
===================================================================
--- tor/trunk/src/common/memarea.c	2009-03-21 10:55:16 UTC (rev 19093)
+++ tor/trunk/src/common/memarea.c	2009-03-21 11:52:53 UTC (rev 19094)
@@ -237,7 +237,7 @@
   size_t ln;
   char *result;
   const char *cp, *end = s+n;
-  for (cp = s; *cp && cp < end; ++cp)
+  for (cp = s; cp < end && *cp; ++cp)
     ;
   /* cp now points to s+n, or to the 0 in the string. */
   ln = cp-s;



More information about the tor-commits mailing list