|
|
4ec855 |
From 486e74dd9b8515f478698fee494086b339015d51 Mon Sep 17 00:00:00 2001
|
|
|
4ec855 |
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@redhat.com>
|
|
|
4ec855 |
Date: Wed, 31 Jul 2019 18:45:29 +0100
|
|
|
4ec855 |
Subject: [PATCH 14/14] Fix heap overflow in ip_reass on big packet input
|
|
|
4ec855 |
MIME-Version: 1.0
|
|
|
4ec855 |
Content-Type: text/plain; charset=UTF-8
|
|
|
4ec855 |
Content-Transfer-Encoding: 8bit
|
|
|
4ec855 |
|
|
|
4ec855 |
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
4ec855 |
Message-id: <20190731184529.21905-2-philmd@redhat.com>
|
|
|
4ec855 |
Patchwork-id: 89820
|
|
|
4ec855 |
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/1] Fix heap overflow in ip_reass on big packet input
|
|
|
4ec855 |
Bugzilla: 1734751
|
|
|
4ec855 |
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
4ec855 |
|
|
|
4ec855 |
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
|
4ec855 |
|
|
|
4ec855 |
When the first fragment does not fit in the preallocated buffer, q will
|
|
|
4ec855 |
already be pointing to the ext buffer, so we mustn't try to update it.
|
|
|
4ec855 |
|
|
|
4ec855 |
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
|
4ec855 |
(cherry picked from libslirp commit 126c04acbabd7ad32c2b018fe10dfac2a3bc1210)
|
|
|
4ec855 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
4ec855 |
|
|
|
4ec855 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
4ec855 |
---
|
|
|
4ec855 |
slirp/ip_input.c | 4 +++-
|
|
|
4ec855 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
4ec855 |
|
|
|
4ec855 |
diff --git a/slirp/ip_input.c b/slirp/ip_input.c
|
|
|
4ec855 |
index 348e1dc..07d8808 100644
|
|
|
4ec855 |
--- a/slirp/ip_input.c
|
|
|
4ec855 |
+++ b/slirp/ip_input.c
|
|
|
4ec855 |
@@ -334,6 +334,8 @@ insert:
|
|
|
4ec855 |
q = fp->frag_link.next;
|
|
|
4ec855 |
m = dtom(slirp, q);
|
|
|
4ec855 |
|
|
|
4ec855 |
+ int was_ext = m->m_flags & M_EXT;
|
|
|
4ec855 |
+
|
|
|
4ec855 |
q = (struct ipasfrag *) q->ipf_next;
|
|
|
4ec855 |
while (q != (struct ipasfrag*)&fp->frag_link) {
|
|
|
4ec855 |
struct mbuf *t = dtom(slirp, q);
|
|
|
4ec855 |
@@ -356,7 +358,7 @@ insert:
|
|
|
4ec855 |
* the old buffer (in the mbuf), so we must point ip
|
|
|
4ec855 |
* into the new buffer.
|
|
|
4ec855 |
*/
|
|
|
4ec855 |
- if (m->m_flags & M_EXT) {
|
|
|
4ec855 |
+ if (!was_ext && m->m_flags & M_EXT) {
|
|
|
4ec855 |
int delta = (char *)q - m->m_dat;
|
|
|
4ec855 |
q = (struct ipasfrag *)(m->m_ext + delta);
|
|
|
4ec855 |
}
|
|
|
4ec855 |
--
|
|
|
4ec855 |
1.8.3.1
|
|
|
4ec855 |
|