[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10346: Try even harder not to dereference the first character after (in tor/branches/tor-0_1_2-patches: . src/or)



Author: nickm
Date: 2007-05-25 20:07:48 -0400 (Fri, 25 May 2007)
New Revision: 10346

Modified:
   tor/branches/tor-0_1_2-patches/
   tor/branches/tor-0_1_2-patches/ChangeLog
   tor/branches/tor-0_1_2-patches/src/or/routerparse.c
Log:
 r12986@catbus:  nickm | 2007-05-25 20:07:08 -0400
 Try even harder not to dereference the first character after an mmap(). [Bug reported by lodger]



Property changes on: tor/branches/tor-0_1_2-patches
___________________________________________________________________
 svk:merge ticket from /tor/012 [r12986] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog	2007-05-25 23:59:47 UTC (rev 10345)
+++ tor/branches/tor-0_1_2-patches/ChangeLog	2007-05-26 00:07:48 UTC (rev 10346)
@@ -1,6 +1,8 @@
 Changes in version 0.1.2.15 - 2007-0?-??
   o Fixes:
     - Fix compile on FreeBSD/NetBSD/OpenBSD. Oops.
+    - Try even harder not to dereference the first character after
+      an mmap(). (Bug reported by lodger)
 
 
 Changes in version 0.1.2.14 - 2007-05-25

Modified: tor/branches/tor-0_1_2-patches/src/or/routerparse.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/routerparse.c	2007-05-25 23:59:47 UTC (rev 10345)
+++ tor/branches/tor-0_1_2-patches/src/or/routerparse.c	2007-05-26 00:07:48 UTC (rev 10346)
@@ -676,6 +676,11 @@
       cp = end = eos;
     }
 
+    /* Start by backing up a character.  If we were at eos, we'll now point
+     * to a valid character. If we were at a \nrouter or \ndirectory-signature,
+     * we'll back up to before the \n. */
+    --cp;
+
     while (cp > *s && (!*cp || TOR_ISSPACE(*cp)))
       --cp;
     /* cp now points to the last non-space character in this descriptor. */