summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-26 00:07:48 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-26 00:07:48 +0000
commit3419e7446e55f77932eaab350414963e34d7b64c (patch)
tree3d1b2a2a87e751c0144a1ff87c9441f5e6773734 /src
parent20773596d3710a878a353082483090f6412364b4 (diff)
downloadtor-3419e7446e55f77932eaab350414963e34d7b64c.tar.gz
tor-3419e7446e55f77932eaab350414963e34d7b64c.zip
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] svn:r10346
Diffstat (limited to 'src')
-rw-r--r--src/or/routerparse.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 6c77eb688e..9fb33a3a56 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -676,6 +676,11 @@ router_parse_list_from_string(const char **s, const char *eos,
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. */