summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-03-26 17:47:21 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-03-26 17:47:21 +0000
commitcd04695c6183a4fbbaf8fda2129ec43e2cb336e1 (patch)
treed54a7ce97e46dee028c718a32441c8db83ef4ea2 /sys
parent20249fa5e4c9956309dff955a0b5e25b2918651c (diff)
don't use mbuf after free; ok mcbride, deraadt, cloder
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_carp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index b0bd1bf3641..898adbb6945 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.43 2004/03/26 08:31:58 mcbride Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.44 2004/03/26 17:47:20 markus Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -391,6 +391,7 @@ carp6_input(struct mbuf **mp, int *offp, int proto)
struct mbuf *m = *mp;
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
struct carp_header *ch;
+ u_int len;
carpstats.carps_ipackets6++;
@@ -417,11 +418,11 @@ carp6_input(struct mbuf **mp, int *offp, int proto)
}
/* verify that we have a complete carp packet */
+ len = m->m_len;
IP6_EXTHDR_GET(ch, struct carp_header *, m, *offp, sizeof(*ch));
if (ch == NULL) {
carpstats.carps_badlen++;
- CARP_LOG("packet size %d too small", m->m_len);
- m_freem(m);
+ CARP_LOG("packet size %u too small", len);
return (IPPROTO_DONE);
}