aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-05-09 01:04:58 +0000
committerNick Mathewson <nickm@torproject.org>2003-05-09 01:04:58 +0000
commit39314a13b0cfeac34d693b748c6bd0b28468d9ec (patch)
tree9728e129f2901beb503dc21ea830fed0566ef16d /src/or/main.c
parent22df330f144292f43de419d2f839af4f9f55ef04 (diff)
downloadtor-39314a13b0cfeac34d693b748c6bd0b28468d9ec.tar
tor-39314a13b0cfeac34d693b748c6bd0b28468d9ec.tar.gz
Thats the letter I and the number 2. (Apologies to Negativland)
svn:r279
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 0b32c8fc4..cb39eb284 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -696,11 +696,12 @@ int
dump_signed_directory_to_string_impl(char *s, int maxlen, directory_t *dir,
crypto_pk_env_t *private_key)
{
- char *cp;
+ char *cp, *eos;
char digest[20];
char signature[128];
int i, written;
routerinfo_t *router;
+ eos = s+maxlen;
strncpy(s,
"signed-directory\n"
"client-software x y z\n" /* XXX make this real */
@@ -711,14 +712,13 @@ dump_signed_directory_to_string_impl(char *s, int maxlen, directory_t *dir,
cp = s+i;
for (i = 0; i < dir->n_routers; ++i) {
router = dir->routers[i];
- written = dump_router_to_string(cp, maxlen-i, router);
+ written = dump_router_to_string(cp, eos-cp, router);
if(written < 0) {
log(LOG_ERR,"dump_signed_directory_to_string(): tried to exceed string length.");
cp[maxlen-1] = 0; /* make sure it's null terminated */
return -1;
}
- i += written;
cp += written;
}