glibc/socket
Arjun Shankar 68507377f2 socket: Check lengths before advancing pointer in CMSG_NXTHDR
The inline and library functions that the CMSG_NXTHDR macro may expand
to increment the pointer to the header before checking the stride of
the increment against available space.  Since C only allows incrementing
pointers to one past the end of an array, the increment must be done
after a length check.  This commit fixes that and includes a regression
test for CMSG_FIRSTHDR and CMSG_NXTHDR.

The Linux, Hurd, and generic headers are all changed.

Tested on Linux on armv7hl, i686, x86_64, aarch64, ppc64le, and s390x.

[BZ #28846]

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
(cherry picked from commit 9c443ac455)
2022-08-22 18:59:26 +02:00
..
bits Make sure that the fortified function conditionals are constant 2022-03-11 20:36:24 +05:30
sys socket: Fix mistyped define statement in socket/sys/socket.h (BZ #29225) 2022-06-06 12:53:58 -03:00
accept4.c
accept.c
bind.c
connect.c
getpeername.c
getsockname.c
getsockopt.c
isfdtype.c
listen.c
Makefile socket: Check lengths before advancing pointer in CMSG_NXTHDR 2022-08-22 18:59:26 +02:00
opensock.c socket: Do not use AF_NETLINK in __opensock 2022-02-03 16:22:10 +01:00
recv.c
recvfrom.c
recvmmsg.c
recvmsg.c
sa_len.c
send.c
sendmmsg.c
sendmsg.c
sendto.c
setsockopt.c
shutdown.c
sockaddr_un_set.c socket: Add the __sockaddr_un_set function 2022-01-17 11:44:41 +01:00
sockatmark.c
socket.c
socketpair.c
tst-accept4.c
tst-cmsghdr-skeleton.c socket: Check lengths before advancing pointer in CMSG_NXTHDR 2022-08-22 18:59:26 +02:00
tst-cmsghdr.c socket: Check lengths before advancing pointer in CMSG_NXTHDR 2022-08-22 18:59:26 +02:00
tst-sockaddr_un_set.c socket: Add the __sockaddr_un_set function 2022-01-17 11:44:41 +01:00
tst-sockopt-time64.c socket: Add time64 alias for getsockopt 2021-07-22 19:16:25 +02:00
tst-sockopt.c socket: Add time64 alias for getsockopt 2021-07-22 19:16:25 +02:00
Versions