Date: Tue, 22 Feb 2022 22:28:08 GMT From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: db8fc0ef23d1 - stable/13 - tcp, udp: improve input validation in handling bind() Message-ID: <202202222228.21MMS8wt027541@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=db8fc0ef23d14cd281e019ee3a15b1a15931237d commit db8fc0ef23d14cd281e019ee3a15b1a15931237d Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2021-08-05 11:42:30 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2022-02-22 22:27:01 +0000 tcp, udp: improve input validation in handling bind() Reported by: syzbot+24fcfd8057e9bc339295@syzkaller.appspotmail.com Reported by: syzbot+6e90ceb5c89285b2655b@syzkaller.appspotmail.com Reviewed by: markj, rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D31422 (cherry picked from commit 3f1f6b6ef7f6fea63583a4b6e917b3cc0f0d525e) --- sys/netinet/tcp_usrreq.c | 1 + sys/netinet/udp_usrreq.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index cf62eeeb18d5..d48a09533f5f 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -326,6 +326,7 @@ tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) * Preserve compatibility with old programs. */ if (nam->sa_family != AF_UNSPEC || + nam->sa_len < offsetof(struct sockaddr_in, sin_zero) || sinp->sin_addr.s_addr != INADDR_ANY) return (EAFNOSUPPORT); nam->sa_family = AF_INET; diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 76ed063391eb..46d687690713 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1635,6 +1635,7 @@ udp_bind(struct socket *so, struct sockaddr *nam, struct thread *td) * Preserve compatibility with old programs. */ if (nam->sa_family != AF_UNSPEC || + nam->sa_len < offsetof(struct sockaddr_in, sin_zero) || sinp->sin_addr.s_addr != INADDR_ANY) return (EAFNOSUPPORT); nam->sa_family = AF_INET;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202222228.21MMS8wt027541>