Skip to content

Commit

Permalink
[IPV6] fix ipv6_getsockopt_sticky copy_to_user leak
Browse files Browse the repository at this point in the history
User supplied len < 0 can cause leak of kernel memory.
Use unsigned compare instead.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Chris Wright authored and David S. Miller committed Mar 10, 2007
1 parent dfee0a7 commit d2b02ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv6/ipv6_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
return 0;
hdr = opt->hopopt;

len = min_t(int, len, ipv6_optlen(hdr));
len = min_t(unsigned int, len, ipv6_optlen(hdr));
if (copy_to_user(optval, hdr, ipv6_optlen(hdr)))
return -EFAULT;
return len;
Expand Down

0 comments on commit d2b02ed

Please sign in to comment.