sysctl-rs
sysctl-rs copied to clipboard
`value_oid_as` is unsound
Transmuting bytes to an arbitrary type can cause undefined behavior.
The safety requirements:
-
T
must beSized
. - The length of bytes must be equal to
size_of::<T>()
. - The alignment of bytes must be equal to
align_of::<T>()
. -
T
must be valid for any binary representation.
https://github.com/johalun/sysctl-rs/blob/57c05e11519b26caed6ccc9260a3b84e185f80d1/src/unix/funcs.rs#L367-L369
+1