diff options
author | Lukas Larsson <[email protected]> | 2018-12-21 11:58:21 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2018-12-21 11:58:21 +0100 |
commit | 6d39c458fbd0b573e8e752121d8cd388e0426917 (patch) | |
tree | 6703e0dc8d31d04beac29603886e8fe78feb8930 | |
parent | f15f8ed428e46b8e40ab07853d4e5ff53deff7d2 (diff) | |
parent | 55bf32b64e1a4bbed588544077a109fc07e1f02d (diff) | |
download | otp-6d39c458fbd0b573e8e752121d8cd388e0426917.tar.gz otp-6d39c458fbd0b573e8e752121d8cd388e0426917.tar.bz2 otp-6d39c458fbd0b573e8e752121d8cd388e0426917.zip |
Merge branch 'maint'
-rw-r--r-- | erts/emulator/drivers/common/inet_drv.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index c75b4045f7..207bef4044 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -634,9 +634,13 @@ static size_t my_strnlen(const char *s, size_t maxlen) * header length. To get the header length we use * the pointer difference from the cmsg start pointer * to the CMSG_DATA(cmsg) pointer. + * + * Some platforms (seen on ppc Linux 2.6.29-3.ydl61.3) + * may return 0 as the cmsg_len if the cmsg is to be ignored. */ #define LEN_CMSG_DATA(cmsg) \ - ((cmsg)->cmsg_len - ((char*)CMSG_DATA(cmsg) - (char*)(cmsg))) + ((cmsg)->cmsg_len < sizeof (struct cmsghdr) ? 0 : \ + (cmsg)->cmsg_len - ((char*)CMSG_DATA(cmsg) - (char*)(cmsg))) #define NXT_CMSG_HDR(cmsg) \ ((struct cmsghdr*)(((char*)(cmsg)) + CMSG_SPACE(LEN_CMSG_DATA(cmsg)))) #endif |