[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11810: When parsing two concatenated networkstatuses (as we do when (in tor/trunk: . src/or)
Author: nickm
Date: 2007-10-09 15:05:38 -0400 (Tue, 09 Oct 2007)
New Revision: 11810
Modified:
tor/trunk/
tor/trunk/src/or/routerparse.c
Log:
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.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r15587] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c 2007-10-09 18:43:05 UTC (rev 11809)
+++ tor/trunk/src/or/routerparse.c 2007-10-09 19:05:38 UTC (rev 11810)
@@ -1531,12 +1531,17 @@
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