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.
pull/5891/head
Shivani Bhardwaj 5 years ago committed by Victor Julien
parent c6aadf0dfa
commit 0ca8591994

@ -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