Skip to content

Commit 6e61b46

Browse files
authored
Fix UB in install_handlers (#94)
1 parent 41659ca commit 6e61b46

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

crash-handler/src/linux/state.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,8 @@ pub unsafe fn install_handlers() {
251251

252252
// Everything is initialized. Transmute the array to the
253253
// initialized type.
254-
*ohl = Some(mem::transmute::<
255-
[std::mem::MaybeUninit<libc::sigaction>; 6],
256-
[libc::sigaction; 6],
257-
>(old_handlers));
254+
let old_handlers = old_handlers.map(|h| h.assume_init());
255+
*ohl = Some(old_handlers);
258256
}
259257
}
260258

0 commit comments

Comments
 (0)