Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fail early when trying to identify a pppoe interface...



details:   https://anonhg.NetBSD.org/src/rev/e06130eb95ed
branches:  trunk
changeset: 518512:e06130eb95ed
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Dec 01 18:25:23 2001 +0000

description:
Fail early when trying to identify a pppoe interface softc (from a
HOST UNIQUE token) and our list of interfaces is empty. Without this
test an unitinalized pointer may be dereferenced.

diffstat:

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

diffs (28 lines):

diff -r a591dce3c1cc -r e06130eb95ed sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Sat Dec 01 17:54:11 2001 +0000
+++ b/sys/net/if_pppoe.c        Sat Dec 01 18:25:23 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.8 2001/11/13 00:49:35 lukem Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.9 2001/12/01 18:25:23 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Martin Husemann. All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.8 2001/11/13 00:49:35 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.9 2001/12/01 18:25:23 martin Exp $");
 
 #include "pppoe.h"
 #include "bpfilter.h"
@@ -276,6 +276,9 @@
 pppoe_find_softc_by_hunique(u_int8_t *token, size_t len, struct ifnet *rcvif)
 {
        struct pppoe_softc *sc, *t;
+
+       if (LIST_EMPTY(&pppoe_softc_list)) return NULL;
+
        if (len != sizeof sc) return NULL;
        memcpy(&t, token, len);
 



Home | Main Index | Thread Index | Old Index