summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-02-15 08:46:13 -0500
committerNick Mathewson <nickm@torproject.org>2018-03-01 16:05:17 -0500
commit8b405c609e82fbfb5470967fc4c45165c708e72b (patch)
treeeb1b2646441e74d8d04dacbe44e535299bc5b9c0 /src/test
parent0953c43c955c4bdb82f0aa86f23f9c0cdcc2c9a1 (diff)
downloadtor-8b405c609e82fbfb5470967fc4c45165c708e72b.tar.gz
tor-8b405c609e82fbfb5470967fc4c45165c708e72b.zip
Forbid "-0" as a protocol version.
Fixes part of 24249; bugfix on 0.2.9.4-alpha.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_protover.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/test_protover.c b/src/test/test_protover.c
index 609003a838..4c41b6db6b 100644
--- a/src/test/test_protover.c
+++ b/src/test/test_protover.c
@@ -151,11 +151,11 @@ test_protover_vote(void *arg)
tt_str_op(result, OP_EQ, "");
tor_free(result);
- /* This fails in Rust, but not in C */
+ /* This fails, since "-0" is not valid. */
smartlist_clear(lst);
smartlist_add(lst, (void*) "Faux=-0");
result = protover_compute_vote(lst, 1);
- tt_str_op(result, OP_EQ, "Faux=0");
+ tt_str_op(result, OP_EQ, "");
tor_free(result);
/* Vote large protover lists that are just below the threshold */
@@ -301,6 +301,8 @@ test_protover_vote_roundtrip(void *args)
{ "Link=1,fred", NULL },
{ "Link=1,fred,3", NULL },
{ "Link=1,9-8,3", NULL },
+ { "Faux=-0", NULL },
+ { "Faux=0--0", NULL },
// "These fail at the splitting stage in Rust, but the number parsing
// stage in C."
{ "Faux=-1", NULL },