jnr / jnr-posix

Java Posix layer
Other
239 stars 91 forks source link

Set cmsghdr.cmsg_len to CMSG_LEN and not CMSG_SPACE. #149

Closed grembo closed 4 years ago

grembo commented 4 years ago

CMSG_SPACE returns the aligned/padded size of the structure to be transmitted and is used correctly for setting msg.msg_controllen, but cmsghdr.cmsg_len is supposed to hold the actual length of the payload, without any padding added for alignment, so that the structure is unpacked correctly at the receiving side.

headius commented 4 years ago

Good catch!