summaryrefslogtreecommitdiffstats
path: root/net/ipv6/ipv6_sockglue.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-03-08 20:48:23 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-25 22:24:17 -0700
commite5268f12f26f1f51590cd1ed26547e21c46b08f2 (patch)
treefd5738c838ff2759a81ee452cb09b8ba16035067 /net/ipv6/ipv6_sockglue.c
parent4c6510a738c71ca6b4b7b624a7d0a00acebfd7fb (diff)
downloadlinux-e5268f12f26f1f51590cd1ed26547e21c46b08f2.tar.gz
linux-e5268f12f26f1f51590cd1ed26547e21c46b08f2.tar.bz2
linux-e5268f12f26f1f51590cd1ed26547e21c46b08f2.zip
[IPV6]: Ensure to truncate result and return full length for sticky options.
Bug noticed by Chris Wright <chrisw@sous-sol.org>. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ipv6_sockglue.c')
-rw-r--r--net/ipv6/ipv6_sockglue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index eceed09e434d..1d56b465bddb 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -825,9 +825,9 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
return 0;
len = min_t(unsigned int, len, ipv6_optlen(hdr));
- if (copy_to_user(optval, hdr, ipv6_optlen(hdr)))
+ if (copy_to_user(optval, hdr, len));
return -EFAULT;
- return len;
+ return ipv6_optlen(hdr);
}
static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,