patch-2.1.127 linux/net/ipv4/ip_masq.c

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

diff -u --recursive --new-file v2.1.126/linux/net/ipv4/ip_masq.c linux/net/ipv4/ip_masq.c
@@ -4,7 +4,7 @@
  *
  * 	Copyright (c) 1994 Pauline Middelink
  *
- *	$Id: ip_masq.c,v 1.26 1998/09/24 03:38:58 davem Exp $
+ *	$Id: ip_masq.c,v 1.27 1998/11/07 14:59:24 davem Exp $
  *
  *
  *	See ip_fw.c for original log
@@ -1011,14 +1011,19 @@
 		switch (skb->ip_summed)
 		{
 			case CHECKSUM_NONE:
+			{
+				int datasz;
 				doff = proto_doff(iph->protocol, h.raw);
-				csum = csum_partial(h.raw + doff, size - doff, 0);
+				datasz = size - doff; 
+				if (datasz < 0) 
+					return -1; 
+				csum = csum_partial(h.raw + doff, datasz, 0);
 				IP_MASQ_DEBUG(3, "O-pkt: %s I-datacsum=%d\n",
 						masq_proto_name(iph->protocol),
 						csum);
 
 				skb->csum = csum_partial(h.raw , doff, csum);
-
+			}
 			case CHECKSUM_HW:
 				if (csum_tcpudp_magic(iph->saddr, iph->daddr, 
 						size, iph->protocol, skb->csum))

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