diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-03-18 21:33:46 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2008-03-18 21:33:46 +0000 |
commit | f3b90de096da508c39afd10077cf08248fd73363 (patch) | |
tree | 759b01d521d49c2c3d6c61be51f5d26723eb680f /sys | |
parent | d008b8b79db0e5b9d5f5262c66f13fabe8efedda (diff) |
Don't use ph after the m_pulldown() calls because the mbuf chain could be
modified. Better save than sorry. OK canacar@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_pppoe.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c index 9fd34e47ff1..1e731a3098e 100644 --- a/sys/net/if_pppoe.c +++ b/sys/net/if_pppoe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppoe.c,v 1.17 2008/03/18 21:23:47 claudio Exp $ */ +/* $OpenBSD: if_pppoe.c,v 1.18 2008/03/18 21:33:45 claudio Exp $ */ /* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */ /* @@ -410,6 +410,7 @@ static void pppoe_dispatch_disc_pkt(struct mbuf *m, int off) u_int16_t session, plen; u_int8_t *ac_cookie; u_int8_t *relay_sid; + u_int8_t code; #ifdef PPPOE_SERVER u_int8_t *hunique; size_t hunique_len; @@ -457,6 +458,7 @@ static void pppoe_dispatch_disc_pkt(struct mbuf *m, int off) session = ntohs(ph->session); plen = ntohs(ph->plen); + code = ph->code; off += sizeof(*ph); if (plen + off > m->m_pkthdr.len) { printf("pppoe: packet content does not fit: data available = %d, packet size = %u\n", @@ -566,7 +568,7 @@ static void pppoe_dispatch_disc_pkt(struct mbuf *m, int off) off += sizeof(*pt) + len; } breakbreak: - switch (ph->code) { + switch (code) { case PPPOE_CODE_PADI: #ifdef PPPOE_SERVER /* @@ -741,7 +743,7 @@ breakbreak: default: printf("%s: unknown code (0x%04x) session = 0x%04x\n", sc ? sc->sc_sppp.pp_if.if_xname : "pppoe", - ph->code, session); + code, session); break; } |