commit 289a7dbac32a981897e12a3c250f0b6c67eec809 Merge: 1ae911660 7edc594ee Author: Nick Mathewson nickm@torproject.org Date: Tue Oct 23 19:21:44 2018 -0400
Merge branch 'maint-0.3.4' into maint-0.3.5
changes/bug27740 | 4 ++++ changes/bug27804 | 3 +++ src/rust/protover/ffi.rs | 3 +++ src/test/test_protover.c | 1 + 4 files changed, 11 insertions(+)
diff --cc src/rust/protover/ffi.rs index 0c28d032c,f55b87acf..f17f30127 --- a/src/rust/protover/ffi.rs +++ b/src/rust/protover/ffi.rs @@@ -57,17 -58,17 +57,20 @@@ pub extern "C" fn protover_all_supporte
let relay_proto_entry: UnvalidatedProtoEntry = match UnvalidatedProtoEntry::from_str_any_len(relay_version) { - Ok(n) => n, - Err(_) => return 1, - }; - let maybe_unsupported: Option<UnvalidatedProtoEntry> = relay_proto_entry.all_supported(); + Ok(n) => n, + Err(_) => return 1, + };
- if maybe_unsupported.is_some() { - let unsupported: UnvalidatedProtoEntry = maybe_unsupported.unwrap(); + if let Some(unsupported) = relay_proto_entry.all_supported() { + if missing_out.is_null() { + return 0; + } - let ptr = allocate_and_copy_string(&unsupported.to_string()); + let c_unsupported: CString = match CString::new(unsupported.to_string()) { + Ok(n) => n, + Err(_) => return 1, + }; + + let ptr = c_unsupported.into_raw(); unsafe { *missing_out = ptr };
return 0;