patch-2.1.28 linux/net/ipv4/ip_sockglue.c

Next file: linux/net/ipv4/packet.c
Previous file: linux/net/ipv4/ip_input.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.27/linux/net/ipv4/ip_sockglue.c linux/net/ipv4/ip_sockglue.c
@@ -171,17 +171,17 @@
 {
 	int val=0,err;
 	unsigned char ucval = 0;
-	int len;
 #if defined(CONFIG_IP_FIREWALL) || defined(CONFIG_IP_ACCT)
 	struct ip_fw tmp_fw;
 #endif	
 
-	if(get_user(len, optval))
-		return -EFAULT;
-	if(len>=sizeof(int) && get_user(val, (int *) optval))
-		return -EFAULT;
-	if(len>=sizeof(char) && get_user(ucval, (unsigned char *) optval))
-		return -EFAULT;
+	if(optlen>=sizeof(int)) {
+		if(get_user(val, (int *) optval))
+			return -EFAULT;
+	} else if(optlen>=sizeof(char)) {
+		if(get_user(ucval, (unsigned char *) optval))
+			return -EFAULT;
+	}
 	
 	if(level!=SOL_IP)
 		return -ENOPROTOOPT;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov