commit a3a8d80bebdbb8988a2f33dea8b18a41e445c06f Merge: 3d1266324 d2bc01905 Author: Nick Mathewson nickm@torproject.org Date: Tue May 22 12:27:15 2018 -0400
Merge branch 'trove-2018-005_032' into trove-2018-005_033
changes/TROVE-2018-005 | 6 ++++++ src/or/dirserv.c | 6 ++++++ src/or/protover.c | 34 ++++++++++++++++++++++++++++++++++ src/or/protover.h | 3 ++- src/test/test_protover.c | 25 +++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 1 deletion(-)
diff --cc src/test/test_protover.c index 7bf1471eb,66deb7551..a7d4667df --- a/src/test/test_protover.c +++ b/src/test/test_protover.c @@@ -125,7 -109,13 +125,14 @@@ test_protover_parse_fail(void *arg /* Broken range */ elts = parse_protocol_list("Link=1,9-8,3"); tt_ptr_op(elts, OP_EQ, NULL); + + /* Protocol name too long */ + elts = parse_protocol_list("DoSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + tt_ptr_op(elts, OP_EQ, NULL); + +#endif done: ; } @@@ -283,23 -267,33 +299,32 @@@ test_protover_all_supported(void *arg tt_str_op(msg, OP_EQ, "Sleen=0-4294967294"); tor_free(msg);
- /* If we get an unparseable list, we say "yes, that's supported." */ -#ifndef HAVE_RUST - // XXXX let's make this section unconditional: rust should behave the - // XXXX same as C here! + /* If we get a (barely) valid (but unsupported list, we say "yes, that's + * supported." */ + tt_assert(protover_all_supported("Fribble=", &msg)); + tt_ptr_op(msg, OP_EQ, NULL); + + /* If we get a completely unparseable list, protover_all_supported should + * hit a fatal assertion for BUG(entries == NULL). */ tor_capture_bugs_(1); tt_assert(protover_all_supported("Fribble", &msg)); - tt_ptr_op(msg, OP_EQ, NULL); tor_end_capture_bugs_();
- /* This case is forbidden. Since it came from a protover_all_supported, - * it can trigger a bug message. */ + /* If we get a completely unparseable list, protover_all_supported should + * hit a fatal assertion for BUG(entries == NULL). */ tor_capture_bugs_(1); tt_assert(protover_all_supported("Sleen=0-4294967295", &msg)); - tt_ptr_op(msg, OP_EQ, NULL); - tor_free(msg); tor_end_capture_bugs_(); -#endif
+ /* Protocol name too long */ + tor_capture_bugs_(1); + tt_assert(protover_all_supported( + "DoSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaa=1-65536", &msg)); + tor_end_capture_bugs_(); + done: tor_end_capture_bugs_(); tor_free(msg);
tor-commits@lists.torproject.org