mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Thats the letter I and the number 2. (Apologies to Negativland)
svn:r279
This commit is contained in:
parent
22df330f14
commit
39314a13b0
@ -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;
|
||||
}
|
||||
|
||||
|
@ -634,6 +634,8 @@ test_dir_format()
|
||||
/* puts(buf); */
|
||||
|
||||
test_assert(! router_get_dir_from_string_impl(buf, &dir2, pk1));
|
||||
test_eq(2, dir2->n_routers);
|
||||
|
||||
|
||||
if (pk1_str) free(pk1_str);
|
||||
if (pk2_str) free(pk2_str);
|
||||
|
Loading…
Reference in New Issue
Block a user