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 MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D31422
This commit is contained in:
parent
89ed2ecb14
commit
3f1f6b6ef7
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user