mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Merge remote-tracking branch 'nickm/bug27741_033' into bug27741_035
Resolve conflicts due to rustfmt, and run rustfmt on the merged code.
This commit is contained in:
commit
7bf9c93ab3
5
changes/bug27741
Normal file
5
changes/bug27741
Normal file
@ -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.
|
@ -184,11 +184,7 @@ pub extern "C" fn protover_get_supported_protocols() -> *const c_char {
|
|||||||
//
|
//
|
||||||
// Why is the threshold a signed integer? —isis
|
// Why is the threshold a signed integer? —isis
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn protover_compute_vote(
|
pub extern "C" fn protover_compute_vote(list: *const Stringlist, threshold: c_int) -> *mut c_char {
|
||||||
list: *const Stringlist,
|
|
||||||
threshold: c_int,
|
|
||||||
allow_long_proto_names: bool,
|
|
||||||
) -> *mut c_char {
|
|
||||||
if list.is_null() {
|
if list.is_null() {
|
||||||
return allocate_and_copy_string("");
|
return allocate_and_copy_string("");
|
||||||
}
|
}
|
||||||
@ -200,16 +196,9 @@ pub extern "C" fn protover_compute_vote(
|
|||||||
let mut proto_entries: Vec<UnvalidatedProtoEntry> = Vec::new();
|
let mut proto_entries: Vec<UnvalidatedProtoEntry> = Vec::new();
|
||||||
|
|
||||||
for datum in data {
|
for datum in data {
|
||||||
let entry: UnvalidatedProtoEntry = if allow_long_proto_names {
|
let entry: UnvalidatedProtoEntry = match datum.parse() {
|
||||||
match UnvalidatedProtoEntry::from_str_any_len(datum.as_str()) {
|
Ok(n) => n,
|
||||||
Ok(n) => n,
|
Err(_) => continue,
|
||||||
Err(_) => continue,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
match datum.parse() {
|
|
||||||
Ok(n) => n,
|
|
||||||
Err(_) => continue,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
proto_entries.push(entry);
|
proto_entries.push(entry);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user