Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net the correct check for BPF_K is with BPF_SRC for BPF_...



details:   https://anonhg.NetBSD.org/src/rev/d258db765e0e
branches:  trunk
changeset: 754141:d258db765e0e
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Apr 21 16:35:09 2010 +0000

description:
the correct check for BPF_K is with BPF_SRC for BPF_ALU ops, from
Guy Harris per PR kern/43185
fixes possible division-by-zero crashes by evil filter expressions
like "len / 0 = 1"
pullup candidate

diffstat:

 sys/net/bpf_filter.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r f02d4267f146 -r d258db765e0e sys/net/bpf_filter.c
--- a/sys/net/bpf_filter.c      Wed Apr 21 16:29:08 2010 +0000
+++ b/sys/net/bpf_filter.c      Wed Apr 21 16:35:09 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf_filter.c,v 1.35 2008/08/20 13:01:54 joerg Exp $    */
+/*     $NetBSD: bpf_filter.c,v 1.36 2010/04/21 16:35:09 drochner Exp $ */
 
 /*-
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.35 2008/08/20 13:01:54 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.36 2010/04/21 16:35:09 drochner Exp $");
 
 #if 0
 #if !(defined(lint) || defined(KERNEL))
@@ -513,7 +513,7 @@
                                /*
                                 * Check for constant division by 0.
                                 */
-                               if (BPF_RVAL(p->code) == BPF_K && p->k == 0)
+                               if (BPF_SRC(p->code) == BPF_K && p->k == 0)
                                        return 0;
                                break;
                        default:



Home | Main Index | Thread Index | Old Index