Fix crash due to incorrect pointer logic in slirp/ip_input.c
PATCH 1/1 Fix crash due to incorrect pointer logic in slirp/ip_input.c
Another memory management bug in the slirp code causes qemu to crash while attempting to reassemble a fragmented IP packet. While iterating through a list of buffers, if m_cat() moves the current buffer, the pointer to the next buffer is read from an invalid location.
The attached patch simply reads the next buffer pointer before calling m_cat(). Incidentally, this is also the fix adopted in the BSD networking stack, from which slirp was originally derived.
--Ed
slirp/ip_input.c +1 -1
@@ -344,8 +344,8 @@while (q != (struct ipasfrag *)fp) {struct mbuf *t; t =dtom (q); -m_cat (m, t); q = (struct ipasfrag *) q->ipf_next; +m_cat (m, t); }/*