glibc/bits
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
..
types Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
byteswap.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
confname.h sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] 2021-02-01 11:00:52 -08:00
dirent_ext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dirent.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dlfcn.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elfclass.h Update. 1999-07-27 05:53:25 +00:00
endian.h Update. 1997-11-26 04:23:08 +00:00
environments.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
errno.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fcntl.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fenv.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
floatn-common.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
floatn.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
flt-eval-method.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fp-fast.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fp-logb.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hwcap.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
in.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
indirect-return.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ioctl-types.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ioctls.h Update. 1997-11-26 04:23:08 +00:00
ipc.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ipctypes.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
iscanonical.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
libc-header-start.h Update floating-point feature test macro handling for C2X 2021-06-01 14:22:06 +00:00
libm-simd-decl-stubs.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
link_lavcurrent.h elf: Issue la_symbind for bind-now (BZ #23734) 2022-04-12 13:32:59 -04:00
link.h * csu/elf-init.c (__libc_csu_fini): Don't do anything here. 2005-01-06 22:40:27 +00:00
local_lim.h Update. 1997-10-15 05:34:02 +00:00
long-double.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
math-vector.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mathdef.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mman.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mqueue.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
msq.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
netdb.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
param.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
poll.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
posix_opt.h Update. 1997-10-15 05:34:02 +00:00
pthreadtypes.h 2002-11-10 Roland McGrath <roland@redhat.com> 2002-11-10 23:22:35 +00:00
resource.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sched.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
select.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sem.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
setjmp.h Update. 1997-11-26 04:23:08 +00:00
shm.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigaction.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigcontext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigevent-consts.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
siginfo-consts.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
signal_ext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
signum-arch.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
signum-generic.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigstack.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigstksz.h sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] 2021-02-01 11:00:52 -08:00
sigthread.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sockaddr.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
socket.h socket: Check lengths before advancing pointer in CMSG_NXTHDR 2022-08-22 18:59:26 +02:00
ss_flags.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stat.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
statfs.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
statvfs.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stdint-intn.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stdint-uintn.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stdlib-bsearch.h Add missing braces to bsearch inline implementation [BZ #28400] 2021-10-01 18:20:12 +02:00
syslog-path.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sysmacros.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
time64.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
time.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
timesize.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
typesizes.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
uintn-identity.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
uio_lim.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
uio-ext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
unistd_ext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
utmp.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
utsname.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
waitflags.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
waitstatus.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
wchar.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
wordsize.h Define wordsize.h macros everywhere 2016-11-04 09:37:44 -07:00