diff options
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 3d161ab..212ccd2 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -244,6 +244,8 @@ tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) * to them. */ sinp = (struct sockaddr_in *)nam; + if (nam->sa_len != sizeof (*sinp)) + return (EINVAL); if (sinp->sin_family == AF_INET && IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) { error = EAFNOSUPPORT; @@ -273,6 +275,8 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) * to them. */ sin6p = (struct sockaddr_in6 *)nam; + if (nam->sa_len != sizeof (*sin6p)) + return (EINVAL); if (sin6p->sin6_family == AF_INET6 && IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) { error = EAFNOSUPPORT; @@ -366,6 +370,8 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) * Must disallow TCP ``connections'' to multicast addresses. */ sinp = (struct sockaddr_in *)nam; + if (nam->sa_len != sizeof (*sinp)) + return (EINVAL); if (sinp->sin_family == AF_INET && IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) { error = EAFNOSUPPORT; @@ -398,6 +404,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) * Must disallow TCP ``connections'' to multicast addresses. */ sin6p = (struct sockaddr_in6 *)nam; + if (nam->sa_len != sizeof (*sin6p)) + return (EINVAL); if (sin6p->sin6_family == AF_INET6 && IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) { error = EAFNOSUPPORT; |