summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2009-08-10 13:20:09 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2009-08-10 13:20:09 +0000
commit42bfab09100b2edae416d415f49f7411ed63162c (patch)
treeee592e0e30a8a05a1152a7ca1a3b93c760c492b1 /sys/netinet
parent7695152f7c8dffbb2d260534cebaf05ff41d02ca (diff)
fix previous:
-m_copydata istead of straight bcopy. noticed by damien -handle the pretty much impossible case that the packet header grows so much that MHLEN < 68. i bet this had been the least of our worries, in that case, but code oughta be correct anyway. ok theo and dlg
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_input.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 0a3f285fd0d..47b2b3e8016 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.167 2009/08/10 11:48:02 henning Exp $ */
+/* $OpenBSD: ip_input.c,v 1.168 2009/08/10 13:20:08 henning Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -1477,8 +1477,8 @@ ip_forward(m, srcrt)
mfake.m_type = m->m_type;
M_DUP_PKTHDR(&mfake, m);
mfake.m_data = mfake.m_pktdat;
- len = min(ntohs(ip->ip_len), 68);
- bcopy(ip, mfake.m_pktdat, len);
+ len = min(min(ntohs(ip->ip_len), 68), MHLEN);
+ m_copydata(m, 0, len, mfake.m_pktdat);
mfake.m_pkthdr.len = mfake.m_len = len;
ip->ip_ttl -= IPTTLDEC;