MT#57977 initialise cmsg buffer

Older glibc uses a strange (and seemingly broken) approach to verifying
the cmsg structures by inspecting the *next* cmsg header and using its
length to see if there is enough space in the buffer. Since we're
constructing the cmsg list, at this point there is no next cmsg yet,
therefore causing spurious failures of CMSG_NXTHDR.

Work around this by initialising the entire buffer first.

See 9c443ac455

closes #1720

Change-Id: I00ce9bc5686ab0c1612aff51f1b3e75d8cbd8a69
pull/1729/head
Richard Fuchs 2 years ago
parent 14dbc561a7
commit 1e4efc60db

@ -180,10 +180,9 @@ INLINE int is_addr_unspecified(const sockaddr_t *a) {
INLINE ssize_t socket_sendiov(socket_t *s, const struct iovec *v, unsigned int len, const endpoint_t *dst,
const sockaddr_t *src)
{
struct msghdr mh;
char ctrl[64];
struct msghdr mh = {0};
char ctrl[64] = {0};
ZERO(mh);
mh.msg_iov = (void *) v;
mh.msg_iovlen = len;

Loading…
Cancel
Save