glibc/socket
Arjun Shankar 9c443ac455 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>
2022-08-02 11:10:25 +02:00
..
bits Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
sys socket: Fix mistyped define statement in socket/sys/socket.h (BZ #29225) 2022-06-06 12:46:14 -03:00
Makefile socket: Check lengths before advancing pointer in CMSG_NXTHDR 2022-08-02 11:10:25 +02:00
Versions Fix mq_notify socket, recv namespace (bug 18546). 2015-06-17 20:20:08 +00:00
accept.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
accept4.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
bind.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
connect.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
getpeername.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
getsockname.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
getsockopt.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
isfdtype.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
listen.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
opensock.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
recv.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
recvfrom.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
recvmmsg.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
recvmsg.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
sa_len.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
send.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
sendmmsg.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
sendmsg.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
sendto.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
setsockopt.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
shutdown.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
sockaddr_un_set.c socket: Add the __sockaddr_un_set function 2022-01-17 10:21:53 +01:00
sockatmark.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
socket.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
socketpair.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-accept4.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-cmsghdr-skeleton.c socket: Check lengths before advancing pointer in CMSG_NXTHDR 2022-08-02 11:10:25 +02:00
tst-cmsghdr.c socket: Check lengths before advancing pointer in CMSG_NXTHDR 2022-08-02 11:10:25 +02:00
tst-sockaddr_un_set.c socket: Add the __sockaddr_un_set function 2022-01-17 10:21:53 +01:00
tst-sockopt-time64.c socket: Add time64 alias for getsockopt 2021-07-22 19:16:25 +02:00
tst-sockopt.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00