diff options
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r-- | net/ipv4/af_inet.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 33b7dffa7732..a366861bf4cd 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -530,6 +530,8 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr, | |||
530 | { | 530 | { |
531 | struct sock *sk = sock->sk; | 531 | struct sock *sk = sock->sk; |
532 | 532 | ||
533 | if (addr_len < sizeof(uaddr->sa_family)) | ||
534 | return -EINVAL; | ||
533 | if (uaddr->sa_family == AF_UNSPEC) | 535 | if (uaddr->sa_family == AF_UNSPEC) |
534 | return sk->sk_prot->disconnect(sk, flags); | 536 | return sk->sk_prot->disconnect(sk, flags); |
535 | 537 | ||
@@ -573,6 +575,9 @@ int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, | |||
573 | int err; | 575 | int err; |
574 | long timeo; | 576 | long timeo; |
575 | 577 | ||
578 | if (addr_len < sizeof(uaddr->sa_family)) | ||
579 | return -EINVAL; | ||
580 | |||
576 | lock_sock(sk); | 581 | lock_sock(sk); |
577 | 582 | ||
578 | if (uaddr->sa_family == AF_UNSPEC) { | 583 | if (uaddr->sa_family == AF_UNSPEC) { |