[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <47F0AA16.1070900@cn.fujitsu.com>
Date: Mon, 31 Mar 2008 17:08:38 +0800
From: Wang Chen <wangchen@...fujitsu.com>
To: "David S. Miller" <davem@...emloft.net>,
YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>
CC: NETDEV <netdev@...r.kernel.org>
Subject: [2.6 PATCH] IPV6: Check length of optval provided by user in setsockopt()
Check length of setsockopt's optval, which provided by user, before copy it
from user space.
Signed-off-by: Wang Chen <wangchen@...fujitsu.com>
---
net/ipv6/ipv6_sockglue.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index bf2a686..1ad0ac9 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -557,6 +557,9 @@ done:
{
struct ipv6_mreq mreq;
+ if (optlen != sizeof(struct ipv6_mreq))
+ goto e_inval;
+
retv = -EPROTO;
if (inet_sk(sk)->is_icsk)
break;
@@ -595,6 +598,9 @@ done:
struct group_req greq;
struct sockaddr_in6 *psin6;
+ if (optlen != sizeof(struct group_req))
+ goto e_inval;
+
retv = -EFAULT;
if (copy_from_user(&greq, optval, sizeof(struct group_req)))
break;
--
1.5.3.4
--
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