Check that sa_len is the appropriate value in tcp_usr_bind(),
tcp6_usr_bind(), tcp_usr_connect(), and tcp6_usr_connect() before checking to see whether the address is multicast so that the proper errno value will be returned if sa_len is incorrect. The checks are identical to the ones in in_pcbbind_setup(), in6_pcbbind(), and in6_pcbladdr(), which are called after the multicast address check passes. MFC after: 30 days
This commit is contained in:
parent
417693c813
commit
3481adf426
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user