patch-2.4.5 linux/net/core/filter.c

Next file: linux/net/decnet/af_decnet.c
Previous file: linux/net/core/dev.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/net/core/filter.c linux/net/core/filter.c
@@ -2,7 +2,7 @@
  * Linux Socket Filter - Kernel level socket filtering
  *
  * Author:
- *     Jay Schulist <jschlst@turbolinux.com>
+ *     Jay Schulist <jschlst@samba.org>
  *
  * Based on the design of:
  *     - The Berkeley Packet Filter
@@ -382,6 +382,9 @@
 	struct sock_filter *ftest;
         int pc;
 
+	if ((unsigned int) flen >= (~0U / sizeof(struct sock_filter)))
+		return -EINVAL;
+
        /*
         * Check the filter code now.
         */
@@ -404,7 +407,7 @@
 				   jumps below, where offsets are limited. --ANK (981016)
 				 */
 				if (ftest->k >= (unsigned)(flen-pc-1))
-					return (-EINVAL);
+					return -EINVAL;
 			}
                         else
 			{
@@ -412,7 +415,7 @@
 				 *	For conditionals both must be safe
 				 */
  				if(pc + ftest->jt +1 >= flen || pc + ftest->jf +1 >= flen)
-					return (-EINVAL);
+					return -EINVAL;
 			}
                 }
 

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