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 2ed85714540f..f71357422380 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -531,6 +531,8 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr, | |||
531 | { | 531 | { |
532 | struct sock *sk = sock->sk; | 532 | struct sock *sk = sock->sk; |
533 | 533 | ||
534 | if (addr_len < sizeof(uaddr->sa_family)) | ||
535 | return -EINVAL; | ||
534 | if (uaddr->sa_family == AF_UNSPEC) | 536 | if (uaddr->sa_family == AF_UNSPEC) |
535 | return sk->sk_prot->disconnect(sk, flags); | 537 | return sk->sk_prot->disconnect(sk, flags); |
536 | 538 | ||
@@ -574,6 +576,9 @@ int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, | |||
574 | int err; | 576 | int err; |
575 | long timeo; | 577 | long timeo; |
576 | 578 | ||
579 | if (addr_len < sizeof(uaddr->sa_family)) | ||
580 | return -EINVAL; | ||
581 | |||
577 | lock_sock(sk); | 582 | lock_sock(sk); |
578 | 583 | ||
579 | if (uaddr->sa_family == AF_UNSPEC) { | 584 | if (uaddr->sa_family == AF_UNSPEC) { |