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 Jan 31, 2019
1 parent ab6166a commit eca27d7
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 292 deletions.
Loading

0 comments on commit eca27d7

Please sign in to comment.