lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070308071048.GD10574@sequoia.sous-sol.org>
Date:	Wed, 7 Mar 2007 23:10:48 -0800
From:	Chris Wright <chrisw@...s-sol.org>
To:	davem@...emloft.net
Cc:	yoshfuji@...ux-ipv6.org, netdev@...r.kernel.org
Subject: IPV6: make ipv6_getsockopt_sticky honor user's buffer size

Make sure not to copy_to_user more than user's buffer can handle (we
already checked the min, just use it) in ipv6_getsockopt_sticky.  And
while there, minor whitespace cleanup now that ipv6_getsockopt_sticky
call can nicely fit on one line.

Signed-off-by: Chris Wright <chrisw@...s-sol.org>
---

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 4e0561a..9396551 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -805,7 +805,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
 	hdr = opt->hopopt;
 
 	len = min_t(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;
 }
@@ -944,8 +944,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
 	{
 
 		lock_sock(sk);
-		len = ipv6_getsockopt_sticky(sk, np->opt,
-					     optval, len);
+		len = ipv6_getsockopt_sticky(sk, np->opt, optval, len);
 		release_sock(sk);
 		return put_user(len, optlen);
 	}
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ