[or-cvs] There is no space after network-status; make router_get_has...

Nick Mathewson nickm at seul.org
Fri Aug 6 19:54:23 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv16710/src/or

Modified Files:
	routerparse.c 
Log Message:
There is no space after network-status; make router_get_hash_impl more bulletproof.

Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- routerparse.c	4 Aug 2004 02:35:06 -0000	1.21
+++ routerparse.c	6 Aug 2004 19:54:20 -0000	1.22
@@ -143,7 +143,7 @@
 int router_get_dir_hash(const char *s, char *digest)
 {
   return router_get_hash_impl(s,digest,
-                              "signed-directory","directory-signature");
+                              "signed-directory","\ndirectory-signature");
 }
 
 /** Set <b>digest</b> to the SHA-1 digest of the hash of the first router in
@@ -152,7 +152,7 @@
 int router_get_router_hash(const char *s, char *digest)
 {
   return router_get_hash_impl(s,digest,
-                              "router ","router-signature");
+                              "router ","\nrouter-signature");
 }
 
 /** Set <b>digest</b> to the SHA-1 digest of the hash of the running-routers
@@ -161,7 +161,7 @@
 int router_get_runningrouters_hash(const char *s, char *digest)
 {
   return router_get_hash_impl(s,digest,
-                              "network-status ","directory-signature");
+                              "network-status","\ndirectory-signature");
 }
 
 /** Parse a date of the format "YYYY-MM-DD hh:mm:ss" and store the result into
@@ -1341,6 +1341,11 @@
     log_fn(LOG_WARN,"couldn't find \"%s\"",start_str);
     return -1;
   }
+  if (start != s && *(start-1) != '\n') {
+    log_fn(LOG_WARN, "first occurance of \"%s\" is not at the start of a line",
+           start_str);
+    return -1;
+  }
   end = strstr(start+strlen(start_str), end_str);
   if (!end) {
     log_fn(LOG_WARN,"couldn't find \"%s\"",end_str);



More information about the tor-commits mailing list