When deleting a fragment header use the simple copy operation only if it fits

completely into the mbuf.
This commit is contained in:
mlelstv 2011-01-22 18:26:36 +00:00
parent 498b8c6e14
commit f724a1d32d
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: frag6.c,v 1.47 2009/03/18 16:00:22 cegger Exp $ */
/* $NetBSD: frag6.c,v 1.48 2011/01/22 18:26:36 mlelstv Exp $ */
/* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */
/*
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.47 2009/03/18 16:00:22 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.48 2011/01/22 18:26:36 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -517,7 +517,7 @@ insert:
/*
* Delete frag6 header with as a few cost as possible.
*/
if (offset < m->m_len) {
if (m->m_len >= offset + sizeof(struct ip6_frag)) {
memmove((char *)ip6 + sizeof(struct ip6_frag), ip6, offset);
m->m_data += sizeof(struct ip6_frag);
m->m_len -= sizeof(struct ip6_frag);