summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-02-25 10:31:36 +0100
committerSebastian Hahn <sebastian@torproject.org>2010-02-27 02:13:22 +0100
commitb67657bd952919d0b738a1ffd6c48cc369604873 (patch)
tree648c9c34cfcbae1dbedad46ce56c3bb6b0ae34a9 /src/or/router.c
parent86828e2004058d01fba09215a44d51d53f82e5c3 (diff)
downloadtor-b67657bd952919d0b738a1ffd6c48cc369604873.tar.gz
tor-b67657bd952919d0b738a1ffd6c48cc369604873.zip
Properly handle non-terminated strings
Treat strings returned from signed_descriptor_get_body_impl() as not NUL-terminated. Since the length of the strings is available, this is not a big problem. Discovered by rieo.
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 97f411dcd6..22644666c1 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1418,6 +1418,7 @@ router_rebuild_descriptor(int force)
ei->cache_info.send_unencrypted = 1;
router_get_router_hash(ri->cache_info.signed_descriptor_body,
+ strlen(ri->cache_info.signed_descriptor_body),
ri->cache_info.signed_descriptor_digest);
routerinfo_set_country(ri);
@@ -1784,7 +1785,7 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
strlcpy(s+written, "router-signature\n", maxlen-written);
written += strlen(s+written);
s[written] = '\0';
- if (router_get_router_hash(s, digest) < 0) {
+ if (router_get_router_hash(s, strlen(s), digest) < 0) {
return -1;
}