From: YOSHIFUJI Hideaki Date: Fri, 9 Mar 2007 04:48:23 +0000 (-0800) Subject: [IPV6]: Ensure to truncate result and return full length for sticky options. X-Git-Tag: v2.6.22-rc1~1128^2~370 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5268f12f26f1f51590cd1ed26547e21c46b08f2;p=linux-2.6 [IPV6]: Ensure to truncate result and return full length for sticky options. Bug noticed by Chris Wright . Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index eceed09e43..1d56b465bd 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,