diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-10-09 19:05:38 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-10-09 19:05:38 +0000 |
commit | a3d4c475151c37ae445b44b9c19f982e98e2a573 (patch) | |
tree | 6f5c6edfa41ebc107d6a601fae5525d3a80df1a9 | |
parent | c9f2afd5fac1b40b1e6240579f22ff82dedbc202 (diff) | |
download | tor-a3d4c475151c37ae445b44b9c19f982e98e2a573.tar.gz tor-a3d4c475151c37ae445b44b9c19f982e98e2a573.zip |
r15587@catbus: nickm | 2007-10-09 15:05:27 -0400
When parsing two concatenated networkstatuses (as we do when voting), detect the end of the first one properly.
svn:r11810
-rw-r--r-- | src/or/routerparse.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 0198233955..ed8fbe384a 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -1531,12 +1531,17 @@ static INLINE const char * find_start_of_next_routerstatus(const char *s) { const char *eos = strstr(s, "\nr "); - if (!eos) - eos = strstr(s, "\ndirectory-signature"); - if (eos) - return eos+1; - else + if (eos) { + const char *eos2 = tor_memstr(s, eos-s, "\ndirectory-signature"); + if (eos2 && eos2 < eos) + return eos2; + else + return eos+1; + } else { + if ((eos = strstr(s, "\ndirectory-signature"))) + return eos+1; return s + strlen(s); + } } /** Given a string at *<b>s</b>, containing a routerstatus object, and an |