diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-10-30 09:35:07 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-10-30 09:35:07 -0400 |
commit | 97324a731f5cbdfd0a00b852f4388c3dd149c7fa (patch) | |
tree | 951766109a5a7f30a9b744ca93820e6012c4af54 | |
parent | ee1cc0feaef6a13f3edf47a42b0c8e5a07603f9c (diff) | |
parent | 7bf9c93ab3af5be6f0881d4bc21fd8d72becff96 (diff) | |
download | tor-97324a731f5cbdfd0a00b852f4388c3dd149c7fa.tar.gz tor-97324a731f5cbdfd0a00b852f4388c3dd149c7fa.zip |
Merge remote-tracking branch 'tor-github/pr/431' into maint-0.3.5
-rw-r--r-- | changes/bug27741 | 5 | ||||
-rw-r--r-- | src/rust/protover/ffi.rs | 19 |
2 files changed, 9 insertions, 15 deletions
diff --git a/changes/bug27741 b/changes/bug27741 new file mode 100644 index 0000000000..531e264b63 --- /dev/null +++ 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 index f17f30127d..ac149fbbbc 100644 --- a/src/rust/protover/ffi.rs +++ b/src/rust/protover/ffi.rs @@ -187,11 +187,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(""); } @@ -203,16 +199,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); } |