I believe you actually want to use `CMSG_DATA(cmsg)` here, rather than `CMSG_LEN(0)`.  These macros seem to do alignment stuff on different platforms, so it seems unwise to assume that the data region begins immediately following the end of the `struct cmsg_hdr` without padding.