tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 22338d63c4e579801788727ca3e09fc15f931622
parent de55df0260a25ed26119174555a17c4b29657a90
Author: Nick Mathewson <nickm@torproject.org>
Date:   Tue, 30 Oct 2018 09:33:58 -0400

Merge remote-tracking branch 'tor-github/pr/431' into bug27740_035_fix

Diffstat:
Achanges/bug27741 | 5+++++
Msrc/rust/protover/ffi.rs | 19++++---------------
2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/changes/bug27741 b/changes/bug27741 @@ -0,0 +1,5 @@ + o Minor bugfixes (rust, directory authority): + - Fix an API mismatch in the rust implementation of + protover_compute_vote(). This bug could have caused crashes on any + directory authorities running Tor with Rust (which we do not yet + recommend). Fixes bug 27741; bugfix on 0.3.3.6. diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs @@ -181,11 +181,7 @@ pub extern "C" fn protover_get_supported_protocols() -> *const c_char { // // Why is the threshold a signed integer? —isis #[no_mangle] -pub extern "C" fn protover_compute_vote( - list: *const Stringlist, - threshold: c_int, - allow_long_proto_names: bool, -) -> *mut c_char { +pub extern "C" fn protover_compute_vote(list: *const Stringlist, threshold: c_int) -> *mut c_char { if list.is_null() { return allocate_and_copy_string(""); } @@ -197,16 +193,9 @@ pub extern "C" fn protover_compute_vote( let mut proto_entries: Vec<UnvalidatedProtoEntry> = Vec::new(); for datum in data { - let entry: UnvalidatedProtoEntry = if allow_long_proto_names { - match UnvalidatedProtoEntry::from_str_any_len(datum.as_str()) { - Ok(n) => n, - Err(_) => continue, - } - } else { - match datum.parse() { - Ok(n) => n, - Err(_) => continue, - } + let entry: UnvalidatedProtoEntry = match datum.parse() { + Ok(n) => n, + Err(_) => continue, }; proto_entries.push(entry); }