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 30, 2019
1 parent 139846a commit 4438203
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 192 deletions.
Loading

0 comments on commit 4438203

Please sign in to comment.