diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-05-01 14:48:06 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-05-01 15:05:09 +0200 |
commit | 7647d1901ea2b34fafd95ecddf52905a3d314368 (patch) | |
tree | b3b0d7315b41034b745870a5e984c6f12f6728c4 | |
parent | e11a6734c4607fee78a1c4fa16c8474f95270b74 (diff) | |
download | glibc-7647d1901ea2b34fafd95ecddf52905a3d314368.tar.gz glibc-7647d1901ea2b34fafd95ecddf52905a3d314368.tar.xz glibc-7647d1901ea2b34fafd95ecddf52905a3d314368.zip |
socket: Fix tst-cmsghdr-skeleton.c use of cmsg_len
cmsg_len is supposed to be socklen_t according to standards, but it was made size_t on Linux, see BZ 16919. For ports that have it socklen_t, SIZE_MAX is too large. We can however explicitly cast it to the type of cmsg_len so it will fit according to that type.
-rw-r--r-- | socket/tst-cmsghdr-skeleton.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/socket/tst-cmsghdr-skeleton.c b/socket/tst-cmsghdr-skeleton.c index 296a0a8581..9516139f87 100644 --- a/socket/tst-cmsghdr-skeleton.c +++ b/socket/tst-cmsghdr-skeleton.c @@ -49,7 +49,7 @@ RUN_TEST_FUNCNAME (CMSG_NXTHDR_IMPL) (void) /* The first header length is so big, using it would cause an overflow. */ cmsg = CMSG_FIRSTHDR (&m); TEST_VERIFY_EXIT ((char *) cmsg == cmsgbuf); - cmsg->cmsg_len = SIZE_MAX; + cmsg->cmsg_len = (__typeof (cmsg->cmsg_len)) SIZE_MAX; cmsg = CMSG_NXTHDR_IMPL (&m, cmsg); TEST_VERIFY_EXIT (cmsg == NULL); |