diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-08-06 19:54:20 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-08-06 19:54:20 +0000 |
commit | 2ff6d6d8b94140a20a8ef6c8a1f7155ef85d275b (patch) | |
tree | 9aa4a9b32609cd1bf528c80e1b3466cc120bb454 | |
parent | 6e9bdc862c34930a9692b8de79b39877a5276a66 (diff) | |
download | tor-2ff6d6d8b94140a20a8ef6c8a1f7155ef85d275b.tar.gz tor-2ff6d6d8b94140a20a8ef6c8a1f7155ef85d275b.zip |
There is no space after network-status; make router_get_hash_impl more bulletproof.
svn:r2162
-rw-r--r-- | src/or/routerparse.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index e4db112150..bf94e84e79 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -143,7 +143,7 @@ static int check_directory_signature(const char *digest, 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_dir_hash(const char *s, char *digest) 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_router_hash(const char *s, char *digest) 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 @@ static int router_get_hash_impl(const char *s, char *digest, 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); |