mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Merge remote-tracking branch 'onionk/rust-allsupportednull1' into maint-0.3.3
This commit is contained in:
commit
169bc670dd
4
changes/bug27740
Normal file
4
changes/bug27740
Normal file
@ -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.
|
3
changes/bug27804
Normal file
3
changes/bug27804
Normal file
@ -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.
|
@ -68,12 +68,10 @@ pub extern "C" fn protover_all_supported(
|
|||||||
|
|
||||||
if maybe_unsupported.is_some() {
|
if maybe_unsupported.is_some() {
|
||||||
let unsupported: UnvalidatedProtoEntry = maybe_unsupported.unwrap();
|
let unsupported: UnvalidatedProtoEntry = maybe_unsupported.unwrap();
|
||||||
let c_unsupported: CString = match CString::new(unsupported.to_string()) {
|
if missing_out.is_null() {
|
||||||
Ok(n) => n,
|
return 0;
|
||||||
Err(_) => return 1,
|
}
|
||||||
};
|
let ptr = allocate_and_copy_string(&unsupported.to_string());
|
||||||
|
|
||||||
let ptr = c_unsupported.into_raw();
|
|
||||||
unsafe { *missing_out = ptr };
|
unsafe { *missing_out = ptr };
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -259,6 +259,7 @@ test_protover_all_supported(void *arg)
|
|||||||
tt_ptr_op(msg, OP_EQ, NULL);
|
tt_ptr_op(msg, OP_EQ, NULL);
|
||||||
|
|
||||||
// Some things we don't support
|
// Some things we don't support
|
||||||
|
tt_assert(! protover_all_supported("Wombat=9", NULL));
|
||||||
tt_assert(! protover_all_supported("Wombat=9", &msg));
|
tt_assert(! protover_all_supported("Wombat=9", &msg));
|
||||||
tt_str_op(msg, OP_EQ, "Wombat=9");
|
tt_str_op(msg, OP_EQ, "Wombat=9");
|
||||||
tor_free(msg);
|
tor_free(msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user