glibc/sysdeps/unix
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
..
alpha
arm
bsd login: Hidden prototypes for _getpt, __ptsname_r, grantpt, unlockpt 2021-06-30 07:28:12 +02:00
i386
inet
mips
powerpc
sh
sysv/linux socket: Check lengths before advancing pointer in CMSG_NXTHDR 2022-08-22 18:59:26 +02:00
x86_64
confstr.h
get_child_max.c
getlogin_r.c
getlogin.c
getpagesize.c
grantpt.c login: Hidden prototypes for _getpt, __ptsname_r, grantpt, unlockpt 2021-06-30 07:28:12 +02:00
ifreq.c
Implies
make-syscalls.sh
Makefile
s-proto-cancel.S
s-proto.S
setxid.h
sockatmark.c
syscall-template.S
syscall.S
syscalls.list misc: Add time64 alias for ioctl 2021-07-21 11:58:09 +02:00
sysdep.h Linux: Explicitly disable cancellation checking in the dynamic loader 2021-05-10 10:31:41 +02:00