]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge branch 'trove-2018-005_032' into trove-2018-005_033
authorNick Mathewson <nickm@torproject.org>
Tue, 22 May 2018 16:27:15 +0000 (12:27 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 22 May 2018 16:27:15 +0000 (12:27 -0400)
1  2 
src/or/dirserv.c
src/or/protover.c
src/or/protover.h
src/test/test_protover.c

Simple merge
Simple merge
Simple merge
index 7bf1471ebd95c37e49944c761d7222679a09f3e3,66deb7551c823d031b2305cd6ad0ad253fc5a4cd..a7d4667dfccaa73cce2251c991e289bf76712f10
@@@ -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);