Source-Changes-HG archive

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

src: Add KASSERT. The input point expects struct ether_header to...



details:   https://anonhg.NetBSD.org/src/rev/1ebfd11a573f
branches:  trunk
changeset: 317937:1ebfd11a573f
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 7491a788964f -r 1ebfd11a573f 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