tor

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

commit 05d65cb067d542a2d7eb001aa300fd8b836a84a0
parent afc22ec5396e677c8cc3f7f14ecec7dc02a75b63
Author: Nick Mathewson <nickm@torproject.org>
Date:   Tue, 23 Oct 2018 19:22:05 -0400

Merge branch 'maint-0.3.5'

Diffstat:
Achanges/bug27740 | 4++++
Achanges/bug27804 | 3+++
Msrc/rust/protover/ffi.rs | 3+++
Msrc/test/test_protover.c | 1+
4 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/changes/bug27740 b/changes/bug27740 @@ -0,0 +1,4 @@ + o Minor bugfixes (rust): + - Return a string that can be safely freed by C code, not one created by + the rust allocator, in protover_all_supported(). Fixes bug 27740; bugfix + on 0.3.3.1-alpha. diff --git a/changes/bug27804 b/changes/bug27804 @@ -0,0 +1,3 @@ + o Minor bugfixes (rust): + - Fix a potential null dereference in protover_all_supported(). + Add a test for it. Fixes bug 27804; bugfix on 0.3.3.1-alpha. diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs @@ -62,6 +62,9 @@ pub extern "C" fn protover_all_supported( }; if let Some(unsupported) = relay_proto_entry.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, diff --git a/src/test/test_protover.c b/src/test/test_protover.c @@ -268,6 +268,7 @@ test_protover_all_supported(void *arg) tt_ptr_op(msg, OP_EQ, NULL); // Some things we don't support + tt_assert(! protover_all_supported("Wombat=9", NULL)); tt_assert(! protover_all_supported("Wombat=9", &msg)); tt_str_op(msg, OP_EQ, "Wombat=9"); tor_free(msg);