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
0ca8591994abfe92bbef20ea6ab1856b11e3efde)
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();