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/e52c3ab45aaa
branches:  trunk
changeset: 965300:e52c3ab45aaa
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 6bae5d66a58e -r e52c3ab45aaa 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