Skip to content

Commit

Permalink
fix: fix misaligned pointer dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
gongzhengyang committed Mar 11, 2024
1 parent 93cd0fd commit 5a4c4ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/unix/network_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fn sockaddr_to_network_addr(sa: *const libc::sockaddr) -> Option<IpAddr> {
None
} else {
let addr = sockaddr_to_addr(
&*(sa as *const libc::sockaddr_storage),
&(sa as *const libc::sockaddr_storage).read_unaligned(),
mem::size_of::<libc::sockaddr_storage>(),
);

Expand Down Expand Up @@ -253,7 +253,7 @@ fn sockaddr_to_network_addr(sa: *const libc::sockaddr) -> Option<IpAddr> {
None
} else {
let addr = sockaddr_to_addr(
&*(sa as *const libc::sockaddr_storage),
&(sa as *const libc::sockaddr_storage).read_unaligned(),
mem::size_of::<libc::sockaddr_storage>(),
);

Expand Down

0 comments on commit 5a4c4ed

Please sign in to comment.