[Git][slirp/libslirp][master] mbuf: Fix copying headers

Samuel Thibault (@sthibaul) gitlab at gitlab.freedesktop.org
Thu Apr 25 18:21:52 UTC 2024



Samuel Thibault pushed to branch master at slirp / libslirp


Commits:
afed1c10 by Samuel Thibault at 2024-04-25T20:21:18+02:00
mbuf: Fix copying headers

Since we increase m->m_len by header_size, we mustn't add header_size
again when copying.

n->m_len also needs to be subtracted header_size, since we advance
n->m_data by header_size.

This only had effect for ipv6 trafic with debug builds

- - - - -


1 changed file:

- src/mbuf.c


Changes:

=====================================
src/mbuf.c
=====================================
@@ -260,8 +260,9 @@ struct mbuf *m_dup(Slirp *slirp, struct mbuf *m,
     if (copy_header) {
         m->m_len += header_size;
         m->m_data -= header_size;
-        mcopy_result = m_copy(n, m, 0, m->m_len + header_size);
+        mcopy_result = m_copy(n, m, 0, m->m_len);
         n->m_data += header_size;
+        n->m_len -= header_size;
         m->m_len -= header_size;
         m->m_data += header_size;
     } else {



View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/afed1c10a5419d0acc44bc957448f72c0467c797

-- 
View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/afed1c10a5419d0acc44bc957448f72c0467c797
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/slirp/attachments/20240425/4e08a315/attachment-0001.htm>


More information about the Slirp mailing list