freebsd-src/sys/netsmb
John Baldwin 5b8178fa46 netsmb: Add bounds checking to smb_t2_placedata
Verify that the requested region of the mbuf chain is not beyond the
end of the chain before trimming it from the end.  If it is out of
bounds, fail with an error (EPROTO).

While here, properly handle the case that the amount of data at the
end of the chain might span more than one mbuf by using m_adj to drop
the extra bytes rather than assuming m_len of the last mbuf can be
adjusted directly.

PR:		258504
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Co-authored-by:	Robert Morris <rtm@lcs.mit.edu>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41229

(cherry picked from commit aca3d65fed)
2023-09-06 14:56:10 -07:00
..
netbios.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
smb.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
smb_conn.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00
smb_conn.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
smb_crypt.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00
smb_dev.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00
smb_dev.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
smb_iod.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00
smb_rq.c netsmb: Add bounds checking to smb_t2_placedata 2023-09-06 14:56:10 -07:00
smb_rq.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
smb_smb.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00
smb_subr.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00
smb_subr.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
smb_tran.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
smb_trantcp.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00
smb_trantcp.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
smb_usr.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00