freebsd-src/usr.sbin/fwcontrol
John Baldwin 9494dfe1b3 fwcontrol: Allocate full fw_asyreq structures passed to the kernel
The FW_ASYREQ ioctl accepts a struct fw_asyreq object as its argument,
meaning that the kernel always copies in the full structure in
sys_ioctl before passing the request down to the driver.  However,
fwcontrol was allocating smaller objects that contained only the
request header and a variable-sized payload.  This means that the
kernel copy in sys_ioctl was reading off the end of this buffer.  On
current architectures this happened to be ok, but it is UB.

Instead, allocate a full structure.

Reported by:	GCC 14 -Walloc-size
Reviewed by:	rlibby, brooks
Differential Revision:	https://reviews.freebsd.org/D46014
2024-07-19 13:09:32 -04:00
..
fwcontrol.8 Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
fwcontrol.c fwcontrol: Allocate full fw_asyreq structures passed to the kernel 2024-07-19 13:09:32 -04:00
fwdv.c Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
fwmethods.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
fwmpegts.c Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00