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 authored and vdagonneau committed Feb 20, 2019
1 parent b3a94a6 commit aacec28
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 288 deletions.
Loading

0 comments on commit aacec28

Please sign in to comment.