Browse Source

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
(cherry picked from commit 1e4efc60db)
rfuchs/dataport-mr11.5
Richard Fuchs 2 years ago
parent
commit
287f6cb211
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      lib/socket.h

+ 2
- 3
lib/socket.h View File

@ -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