diff options
Diffstat (limited to 'net/ipv4/af_inet.c')
| -rw-r--r-- | net/ipv4/af_inet.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 33b7dffa7732..f71357422380 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
| @@ -86,6 +86,7 @@ | |||
| 86 | #include <linux/poll.h> | 86 | #include <linux/poll.h> |
| 87 | #include <linux/netfilter_ipv4.h> | 87 | #include <linux/netfilter_ipv4.h> |
| 88 | #include <linux/random.h> | 88 | #include <linux/random.h> |
| 89 | #include <linux/slab.h> | ||
| 89 | 90 | ||
| 90 | #include <asm/uaccess.h> | 91 | #include <asm/uaccess.h> |
| 91 | #include <asm/system.h> | 92 | #include <asm/system.h> |
| @@ -530,6 +531,8 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr, | |||
| 530 | { | 531 | { |
| 531 | struct sock *sk = sock->sk; | 532 | struct sock *sk = sock->sk; |
| 532 | 533 | ||
| 534 | if (addr_len < sizeof(uaddr->sa_family)) | ||
| 535 | return -EINVAL; | ||
| 533 | if (uaddr->sa_family == AF_UNSPEC) | 536 | if (uaddr->sa_family == AF_UNSPEC) |
| 534 | return sk->sk_prot->disconnect(sk, flags); | 537 | return sk->sk_prot->disconnect(sk, flags); |
| 535 | 538 | ||
| @@ -573,6 +576,9 @@ int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, | |||
| 573 | int err; | 576 | int err; |
| 574 | long timeo; | 577 | long timeo; |
| 575 | 578 | ||
| 579 | if (addr_len < sizeof(uaddr->sa_family)) | ||
| 580 | return -EINVAL; | ||
| 581 | |||
| 576 | lock_sock(sk); | 582 | lock_sock(sk); |
| 577 | 583 | ||
| 578 | if (uaddr->sa_family == AF_UNSPEC) { | 584 | if (uaddr->sa_family == AF_UNSPEC) { |
