summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-10-07 18:33:30 +0000
committerNick Mathewson <nickm@torproject.org>2005-10-07 18:33:30 +0000
commit4c7113d26ad754036109fadb4ed7a03b190babe3 (patch)
tree6741715f295e00658f9893c41498ccfde31db1bd
parenta89daaeca90b84bed9ab802965c13705a18ed1a9 (diff)
downloadtor-4c7113d26ad754036109fadb4ed7a03b190babe3.tar.gz
tor-4c7113d26ad754036109fadb4ed7a03b190babe3.zip
Strip extra trailing newlines when parsing router descriptors.
svn:r5212
-rw-r--r--src/or/routerparse.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 313fcfd6aa..b5f1db05d4 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -694,6 +694,10 @@ router_parse_entry_from_string(const char *s, const char *end)
end = s + strlen(s);
}
+ /* point 'end' to a point immediately after the final newline. */
+ while (end > s+2 && *(end-1) == '\n' && *(end-2) == '\n')
+ --end;
+
if (router_get_router_hash(s, digest) < 0) {
log_fn(LOG_WARN, "Couldn't compute router hash.");
return NULL;