]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Remove extraneous argument from Rust protover_compute_vote()
authorNick Mathewson <nickm@torproject.org>
Mon, 17 Sep 2018 15:50:46 +0000 (11:50 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 17 Sep 2018 15:57:56 +0000 (11:57 -0400)
This argument was added to match an older idea for the C api, but we
decided not to do it that way in C.

Fixes bug 27741; bugfix on 0.3.3.6 / TROVE-2018-005 fix.

changes/bug27741 [new file with mode: 0644]
src/rust/protover/ffi.rs

diff --git a/changes/bug27741 b/changes/bug27741
new file mode 100644 (file)
index 0000000..531e264
--- /dev/null
@@ -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.
index 9656e8c31854a77dd487fbe76f68787ff82e98c8..f803bd01558bc5e0da898a18e2ecc014ba48127a 100644 (file)
@@ -207,8 +207,7 @@ pub extern "C" fn protover_get_supported_protocols() -> *const c_char {
 #[no_mangle]
 pub extern "C" fn protover_compute_vote(
     list: *const Stringlist,
-    threshold: c_int,
-    allow_long_proto_names: bool,
+    threshold: c_int
 ) -> *mut c_char {
 
     if list.is_null() {
@@ -223,13 +222,9 @@ pub extern "C" fn protover_compute_vote(
     let mut proto_entries: Vec<UnvalidatedProtoEntry> = Vec::new();
 
     for datum in data {
-        let entry: UnvalidatedProtoEntry = match allow_long_proto_names {
-            true => match UnvalidatedProtoEntry::from_str_any_len(datum.as_str()) {
-                Ok(n)  => n,
-                Err(_) => continue},
-            false => match datum.parse() {
-                Ok(n)  => n,
-                Err(_) => continue},
+        let entry: UnvalidatedProtoEntry = match datum.parse() {
+            Ok(n)  => n,
+            Err(_) => continue
         };
         proto_entries.push(entry);
     }