tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit a75ae628c74d8105d7b021b051ffd6eaaed08904
parent 7aa94f744112d224dd7a5523faef7a9b858ad5b1
Author: Nick Mathewson <nickm@torproject.org>
Date:   Sun, 11 Feb 2018 16:17:41 -0500

Merge remote-tracking branch 'isis/bug25127_redux'

Diffstat:
Msrc/rust/protover/ffi.rs | 2+-
Msrc/rust/protover/protover.rs | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs @@ -232,7 +232,7 @@ pub extern "C" fn protover_compute_for_old_tor(version: *const c_char) -> *const // we can see that the bytes we're passing into it 1) are valid UTF-8, // 2) have no intermediate NUL bytes, and 3) are terminated with a NUL // byte. - supported = CStr::from_bytes_with_nul(elder_protocols).unwrap(); + supported = CStr::from_bytes_with_nul(elder_protocols).unwrap_or(empty); supported.as_ptr() } diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs @@ -110,7 +110,7 @@ pub fn get_supported_protocols() -> &'static str { // The `unwrap` is safe becauase we SUPPORTED_PROTOCOLS is under // our control. str::from_utf8(&SUPPORTED_PROTOCOLS[..SUPPORTED_PROTOCOLS.len() - 1]) - .unwrap() + .unwrap_or("") } pub struct SupportedProtocols(HashMap<Proto, Versions>);