From d5b735ae7900c57e2a43ce04f6539454c00866ab Mon Sep 17 00:00:00 2001 From: thorpej Date: Sat, 15 Aug 1998 06:56:12 +0000 Subject: [PATCH] In the NewMedia callback, make sure we have a LAN Node ID tuple. --- sys/dev/pcmcia/if_sm_pcmcia.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/dev/pcmcia/if_sm_pcmcia.c b/sys/dev/pcmcia/if_sm_pcmcia.c index 8069fb478661..4d34b18f440f 100644 --- a/sys/dev/pcmcia/if_sm_pcmcia.c +++ b/sys/dev/pcmcia/if_sm_pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sm_pcmcia.c,v 1.8 1998/08/15 06:46:33 thorpej Exp $ */ +/* $NetBSD: if_sm_pcmcia.c,v 1.9 1998/08/15 06:56:12 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -293,8 +293,15 @@ sm_pcmcia_newmedia_ciscallback(tuple, arg) int i; if (tuple->code == PCMCIA_CISTPL_FUNCE) { - if (tuple->length < ETHER_ADDR_LEN) + /* subcode, length */ + if (tuple->length < 2) return (0); + + if ((pcmcia_tuple_read_1(tuple, 0) != + PCMCIA_TPLFE_TYPE_LAN_NID) || + (pcmcia_tuple_read_1(tuple, 1) != ETHER_ADDR_LEN)) + return (0); + for (i = 0; i < ETHER_ADDR_LEN; i++) myla[i] = pcmcia_tuple_read_1(tuple, i + 2); return (1);