mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
Fix a rare bug in rend_fn tests when the randomly generated port is 0
Since the rend code doesn't like the port to be 0, we shouldn't generate the port by declaring crypto_rand_int(65536); instead we should say crypto_rand_int(65535)+1. Diagnosed by Matt Edman; fixes bug 1808.
This commit is contained in:
parent
93edf0cb6c
commit
f060b18e6c
@ -1029,7 +1029,7 @@ test_rend_fns(void)
|
|||||||
intro->extend_info->identity_digest, DIGEST_LEN);
|
intro->extend_info->identity_digest, DIGEST_LEN);
|
||||||
/* Does not cover all IP addresses. */
|
/* Does not cover all IP addresses. */
|
||||||
tor_addr_from_ipv4h(&intro->extend_info->addr, crypto_rand_int(65536));
|
tor_addr_from_ipv4h(&intro->extend_info->addr, crypto_rand_int(65536));
|
||||||
intro->extend_info->port = crypto_rand_int(65536);
|
intro->extend_info->port = 1 + crypto_rand_int(65535);
|
||||||
intro->intro_key = crypto_pk_dup_key(pk2);
|
intro->intro_key = crypto_pk_dup_key(pk2);
|
||||||
smartlist_add(generated->intro_nodes, intro);
|
smartlist_add(generated->intro_nodes, intro);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user