diff --git a/src/ip_input.c b/src/ip_input.c index 50c7657d55e05762f2559853afa186e788573da8..8c75d91495dfdb32f00aea66acd3b5a5936df858 100644 --- a/src/ip_input.c +++ b/src/ip_input.c @@ -326,6 +326,8 @@ insert: q = fp->frag_link.next; m = dtom(slirp, q); + int was_ext = m->m_flags & M_EXT; + q = (struct ipasfrag *)q->ipf_next; while (q != (struct ipasfrag *)&fp->frag_link) { struct mbuf *t = dtom(slirp, q); @@ -348,7 +350,7 @@ insert: * the old buffer (in the mbuf), so we must point ip * into the new buffer. */ - if (m->m_flags & M_EXT) { + if (!was_ext && m->m_flags & M_EXT) { int delta = (char *)q - m->m_dat; q = (struct ipasfrag *)(m->m_ext + delta); }