summaryrefslogtreecommitdiff
path: root/src/rust
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2018-09-21 04:57:26 +0000
committercypherpunks <cypherpunks@torproject.org>2018-09-21 04:57:26 +0000
commitdb89b4b1527103455e1bd85839a88d614a402354 (patch)
treeb0d0089d7cb10449511ca0e65490ffd617db676f /src/rust
parent75b95e1c8e28e1136b5bc98fd89321e478f4b836 (diff)
downloadtor-db89b4b1527103455e1bd85839a88d614a402354.tar.gz
tor-db89b4b1527103455e1bd85839a88d614a402354.zip
rust/protover: fix null deref in protover_all_supported()
Fortunately with the current callers it couldn't happen in practice. Fix on d1820c1516a31a149fc51a9e5126bf899e4c4e08.
Diffstat (limited to 'src/rust')
-rw-r--r--src/rust/protover/ffi.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs
index 9656e8c318..ca9a504fe1 100644
--- a/src/rust/protover/ffi.rs
+++ b/src/rust/protover/ffi.rs
@@ -68,6 +68,9 @@ pub extern "C" fn protover_all_supported(
if maybe_unsupported.is_some() {
let unsupported: UnvalidatedProtoEntry = maybe_unsupported.unwrap();
+ if missing_out.is_null() {
+ return 0;
+ }
let c_unsupported: CString = match CString::new(unsupported.to_string()) {
Ok(n) => n,
Err(_) => return 1,