From 632e0406595ade9da40317a777f438c43ea5b5f3 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Oct 2018 07:37:17 -0400 Subject: [PATCH 1/2] Try to restore a proper fix for bug27740 in 0.3.5. (I messed up the merge in 289a7dbac32a981897e12a3c250f0b6c67eec809.) --- src/rust/protover/ffi.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs index f17f30127d..e29efd6dfc 100644 --- a/src/rust/protover/ffi.rs +++ b/src/rust/protover/ffi.rs @@ -65,12 +65,7 @@ pub extern "C" fn protover_all_supported( if missing_out.is_null() { return 0; } - let c_unsupported: CString = match CString::new(unsupported.to_string()) { - Ok(n) => n, - Err(_) => return 1, - }; - - let ptr = c_unsupported.into_raw(); + let ptr = allocate_and_copy_string(&unsupported.to_string()); unsafe { *missing_out = ptr }; return 0; From de55df0260a25ed26119174555a17c4b29657a90 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Oct 2018 09:28:10 -0400 Subject: [PATCH 2/2] remove now-unused "use" statement. --- src/rust/protover/ffi.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs index e29efd6dfc..451bf4665d 100644 --- a/src/rust/protover/ffi.rs +++ b/src/rust/protover/ffi.rs @@ -7,7 +7,6 @@ use libc::{c_char, c_int, uint32_t}; use std::ffi::CStr; -use std::ffi::CString; use smartlist::*; use tor_allocate::allocate_and_copy_string;