Closed shinmao closed 2 months ago
"This is horrible" refers to the whole sequence, with three unsafe
expressions close together (:
How could addr6
be misaligned? It is a *const sockaddr
we get from the OS, which is meant to be reinterpreted as sockaddr_<depending on sa_family>
; we don't do anything weird with it.
…also you've already reported this: #120
Unsoundness
Hi, as I saw "this is horrible" in your code of
parse_addr
, does it mean the misaligned raw pointeraddr6
created in line 54 could cause to undefined behavior here? https://github.com/valpackett/systemstat/blob/cbd9c1638b792d1819479f0c2baa5840f65af727/src/platform/unix.rs#L52-L57 As I know, misaligned pointer dereference here might have inconsistent value in different architecture, so we should avoid it.