patch-2.2.19 linux/net/ipv6/ipv6_sockglue.c

Next file: linux/net/ipv6/raw.c
Previous file: linux/net/ipv4/udp.c
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.18/net/ipv6/ipv6_sockglue.c linux/net/ipv6/ipv6_sockglue.c
@@ -230,6 +230,10 @@
 
 		if (optlen == 0)
 			goto update;
+		
+		retv = -EINVAL;
+		if(optlen > 1024)
+			break;
 
 		opt = sock_kmalloc(sk, sizeof(*opt) + optlen, GFP_KERNEL);
 		retv = -ENOBUFS;
@@ -359,6 +363,8 @@
 		return -ENOPROTOOPT;
 	if (get_user(len, optlen))
 		return -EFAULT;
+	if(len < 0)
+		return -EINVAL;
 	switch (optname) {
 	case IPV6_PKTOPTIONS:
 	{

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)