From c56faa76d830a4ab41bc25f07c5ea4c237b5ebc0 Mon Sep 17 00:00:00 2001 From: yamt Date: Thu, 11 Jul 2002 21:21:53 +0000 Subject: [PATCH] don't access freed memory. --- sys/net/if_spppsubr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 0c467bd3206e..165cf82204bc 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.48 2002/07/06 18:33:45 itojun Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.49 2002/07/11 21:21:53 yamt Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.48 2002/07/06 18:33:45 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.49 2002/07/11 21:21:53 yamt Exp $"); #include "opt_inet.h" #include "opt_ipx.h" @@ -733,9 +733,11 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, * - we flag TCP packets with src ip 0 as an error */ if (ip && ip->ip_src.s_addr == INADDR_ANY) { + u_int8_t proto = ip->ip_p; + m_freem(m); splx(s); - if (ip->ip_p == IPPROTO_TCP) + if (proto == IPPROTO_TCP) return(EADDRNOTAVAIL); else return(0);