HomeFreeBSD

MFC r349989:

Description

MFC r349989:

Improve the input validation for l_linger.
When using the SOL_SOCKET level socket option SO_LINGER, the structure
struct linger is used as the option value. The component l_linger is of
type int, but internally copied to the field so_linger of the structure
struct socket. The type of so_linger is short, but it is assumed to be
non-negative and the value is used to compute ticks to be stored in a
variable of type int.

Therefore, perform input validation on l_linger similar to the one
performed by NetBSD and OpenBSD.

Thanks to syzkaller for making me aware of this issue.

Thanks to markj@ for pointing out that a similar check should be added
to so_linger_set().

Reviewed by: markj@
Differential Revision: https://reviews.freebsd.org/D20948

Details

Provenance
tuexenAuthored on
Differential Revision
D20948: Input validation for l_linger
Parents
rS351972: MFC r349986:
Branches
Unknown
Tags
Unknown