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. The input point expects struct ether_he...



details:   https://anonhg.NetBSD.org/src/rev/4fa6a1251ef8
branches:  trunk
changeset: 321894:4fa6a1251ef8
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Apr 09 11:35:22 2018 +0000

description:
Add KASSERT. The input point expects struct ether_header to be there.

Now, I'm wondering whether it can be triggered by L2 encapsulation
protocols - they may not provide a contiguous area.

diffstat:

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

diffs (26 lines):

diff -r aa6c61124b8e -r 4fa6a1251ef8 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Mon Apr 09 11:05:59 2018 +0000
+++ b/sys/net/if_ethersubr.c    Mon Apr 09 11:35:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.261 2018/04/09 11:05:59 maxv Exp $  */
+/*     $NetBSD: if_ethersubr.c,v 1.262 2018/04/09 11:35:22 maxv Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.261 2018/04/09 11:05:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.262 2018/04/09 11:35:22 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -588,6 +588,7 @@
 
        KASSERT(!cpu_intr_p());
        KASSERT((m->m_flags & M_PKTHDR) != 0);
+       KASSERT(m->m_len >= sizeof(*eh));
 
        if ((ifp->if_flags & IFF_UP) == 0) {
                m_freem(m);



Home | Main Index | Thread Index | Old Index