Skip to content

Commit

Permalink
Fix misaligned references when using recvmsg with control messages
Browse files Browse the repository at this point in the history
On some platforms the alignment of cmsg_data could be less than the
alignment of the messages that it contains.  That led to unaligned
reads
on those platforms.  This change fixes the issue by always copying the
message contents into aligned objects.  The change is not 100%
backwards
compatible when using recvmsg.  Users may have to replace code like
this:

```rust
if let ControlMessage::ScmRights(&fds) = cmsg {
```

with this:
```rust
if let ControlMessageOwned::ScmRights(fds) = cmsg {
```

Fixes nix-rust#999
  • Loading branch information
asomers committed Feb 12, 2019
1 parent 9f69c7d commit d2db7b3
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 288 deletions.
Loading

0 comments on commit d2db7b3

Please sign in to comment.