dcerpc/udp: remove transmute

The book defines transmute as "This is really, truly, the most horribly unsafe
thing you can do in Rust. The guardrails here are dental floss."
Transmute can result into mind boggling undefined behaviors. Get rid of
it wherever possible.

(cherry picked from commit 0ca8591994)
pull/5934/head
Shivani Bhardwaj 6 years ago committed by Victor Julien
parent a11f37f1ca
commit 6801590aa1

@ -275,7 +275,7 @@ pub extern "C" fn rs_dcerpc_udp_get_tx(
let dce_state = cast_pointer!(state, DCERPCUDPState);
match dce_state.get_tx(tx_id) {
Some(tx) => {
return unsafe{transmute(tx)};
return unsafe{&mut *(tx as *mut DCERPCTransaction)};
},
None => {
return std::ptr::null_mut();

Loading…
Cancel
Save