aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-07 14:31:58 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-07 14:31:58 -0400
commitf060b18e6c4292be58de0e1b08f25b770cbddff8 (patch)
tree586dd6124e004b093682ddeea3b8c27a7000b483 /src/test
parent93edf0cb6c01a3d861c3147a3a9d3f63f8f80aad (diff)
downloadtor-f060b18e6c4292be58de0e1b08f25b770cbddff8.tar
tor-f060b18e6c4292be58de0e1b08f25b770cbddff8.tar.gz
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.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/test.c b/src/test/test.c
index 8f6564c48..9948ecf99 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -1029,7 +1029,7 @@ test_rend_fns(void)
intro->extend_info->identity_digest, DIGEST_LEN);
/* Does not cover all IP addresses. */
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);
smartlist_add(generated->intro_nodes, intro);
}