summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-11-16 17:15:40 +0000
committerRoger Dingledine <arma@torproject.org>2003-11-16 17:15:40 +0000
commitb5e84e24aeb4fa2cb3d238b037fbc1157f4c48fa (patch)
treebe97478bb0a88e408e5085097cd518e76a6546f0
parentfe856406bea6f759a38e25c5f64e133c2631d2a6 (diff)
downloadtor-b5e84e24aeb4fa2cb3d238b037fbc1157f4c48fa.tar.gz
tor-b5e84e24aeb4fa2cb3d238b037fbc1157f4c48fa.zip
dump exit policies correctly to descriptor
svn:r815
-rw-r--r--src/or/routers.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/or/routers.c b/src/or/routers.c
index a7069f12e1..00efba68e3 100644
--- a/src/or/routers.c
+++ b/src/or/routers.c
@@ -1198,6 +1198,10 @@ static void get_platform_str(char *platform, int len)
return;
}
+/* XXX need to audit this thing and count fenceposts. maybe
+ * refactor so we don't have to keep asking if we're
+ * near the end of maxlen?
+ */
#define DEBUG_ROUTER_DUMP_ROUTER_TO_STRING
int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
crypto_pk_env_t *ident_key) {
@@ -1251,7 +1255,7 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
"onion-key\n%s"
"link-key\n%s"
"signing-key\n%s",
- router->nickname,
+ router->nickname,
router->address,
router->or_port,
router->socks_port,
@@ -1294,11 +1298,15 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
return -1;
written += result;
} else {
- if (written > maxlen-3)
+ if (written > maxlen-4)
return -1;
strcat(s+written, ":*");
}
- }
+ if(written > maxlen-1)
+ return -1;
+ strcat(s+written, "\n");
+ written++;
+ } /* end for */
if (written > maxlen-256) /* Not enough room for signature. */
return -1;