aboutsummaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-06-22 07:01:54 +0000
committerNick Mathewson <nickm@torproject.org>2006-06-22 07:01:54 +0000
commitb7910202a306dbeb7b3ce024dc166ac9ea7de44f (patch)
tree77b1807eae66799a08938052d5024c7dc8a44c96 /src/or/router.c
parentfb6d4855baf0cddc7ce4bff73b12822414013282 (diff)
downloadtor-b7910202a306dbeb7b3ce024dc166ac9ea7de44f.tar.gz
tor-b7910202a306dbeb7b3ce024dc166ac9ea7de44f.zip
Next batch of memory miserdom: mmap cached-routers file. This is sure to break somewhere.
svn:r6675
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 47224de14b..43a1834dd0 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -777,7 +777,10 @@ router_get_my_descriptor(void)
const char *body;
if (!router_get_my_routerinfo())
return NULL;
+ /* Make sure this is nul-terminated. */
+ tor_assert(desc_routerinfo->cache_info.saved_location == SAVED_NOWHERE);
body = signed_descriptor_get_body(&desc_routerinfo->cache_info);
+ tor_assert(!body[desc_routerinfo->cache_info.signed_descriptor_len]);
log_debug(LD_GENERAL,"my desc is '%s'", body);
return body;
}
@@ -1187,7 +1190,7 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
#ifdef DEBUG_ROUTER_DUMP_ROUTER_TO_STRING
cp = s_tmp = s_dup = tor_strdup(s);
- ri_tmp = router_parse_entry_from_string(cp, NULL);
+ ri_tmp = router_parse_entry_from_string(cp, NULL, 1);
if (!ri_tmp) {
log_err(LD_BUG,
"We just generated a router descriptor we can't parse: <<%s>>",