Source-Changes-HG archive

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

[src/trunk]: src/sys/net Add KASSERT to catch bugs. Something tells me it cou...



details:   https://anonhg.NetBSD.org/src/rev/1bcc5a20fae2
branches:  trunk
changeset: 454248:1bcc5a20fae2
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Sep 12 07:38:19 2019 +0000

description:
Add KASSERT to catch bugs. Something tells me it could easily fire.

diffstat:

 sys/net/bpf.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 7c533204ea54 -r 1bcc5a20fae2 sys/net/bpf.c
--- a/sys/net/bpf.c     Thu Sep 12 06:39:47 2019 +0000
+++ b/sys/net/bpf.c     Thu Sep 12 07:38:19 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf.c,v 1.229 2019/07/10 17:55:33 maxv Exp $   */
+/*     $NetBSD: bpf.c,v 1.230 2019/09/12 07:38:19 maxv Exp $   */
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.229 2019/07/10 17:55:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.230 2019/09/12 07:38:19 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -1680,6 +1680,7 @@
                cpfn = (void *)memcpy;
                marg = mtod(m, void *);
                buflen = pktlen;
+               KASSERT(buflen != 0);
        } else {
                cpfn = bpf_mcpy;
                marg = m;



Home | Main Index | Thread Index | Old Index