thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
902636
From 5c2c5496083fa549e1dff903413bb6136fc19d8d Mon Sep 17 00:00:00 2001
902636
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
902636
Date: Fri, 17 Jan 2020 12:07:56 +0100
902636
Subject: [PATCH 1/4] tcp_emu: Fix oob access
d8ab4a
MIME-Version: 1.0
d8ab4a
Content-Type: text/plain; charset=UTF-8
d8ab4a
Content-Transfer-Encoding: 8bit
d8ab4a
902636
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
902636
Message-id: <20200117120758.1076549-2-marcandre.lureau@redhat.com>
902636
Patchwork-id: 93399
902636
O-Subject: [RHEL-AV-8.1.0 qemu-kvm + RHEL-AV-8.2.0 qemu-kvm PATCH 1/3] tcp_emu: Fix oob access
902636
Bugzilla: 1791568
902636
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
d8ab4a
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
016a62
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
d8ab4a
d8ab4a
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
d8ab4a
d8ab4a
The main loop only checks for one available byte, while we sometimes
d8ab4a
need two bytes.
d8ab4a
902636
[ MA - minor conflict, CHANGELOG.md absent ]
d8ab4a
(cherry picked from libslirp commit 2655fffed7a9e765bcb4701dd876e9dab975f289)
902636
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
d8ab4a
016a62
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
d8ab4a
---
902636
 slirp/src/tcp_subr.c | 7 +++++++
d8ab4a
 1 file changed, 7 insertions(+)
d8ab4a
902636
diff --git a/slirp/src/tcp_subr.c b/slirp/src/tcp_subr.c
902636
index d6dd133..cbecd64 100644
902636
--- a/slirp/src/tcp_subr.c
902636
+++ b/slirp/src/tcp_subr.c
902636
@@ -886,6 +886,9 @@ int tcp_emu(struct socket *so, struct mbuf *m)
902636
                 break;
d8ab4a
 
902636
             case 5:
902636
+                if (bptr == m->m_data + m->m_len - 1)
902636
+                        return 1; /* We need two bytes */
d8ab4a
+
902636
                 /*
902636
                  * The difference between versions 1.0 and
902636
                  * 2.0 is here. For future versions of
902636
@@ -901,6 +904,10 @@ int tcp_emu(struct socket *so, struct mbuf *m)
902636
                 /* This is the field containing the port
902636
                  * number that RA-player is listening to.
902636
                  */
d8ab4a
+
902636
+                if (bptr == m->m_data + m->m_len - 1)
902636
+                        return 1; /* We need two bytes */
d8ab4a
+
902636
                 lport = (((uint8_t *)bptr)[0] << 8) + ((uint8_t *)bptr)[1];
902636
                 if (lport < 6970)
902636
                     lport += 256; /* don't know why */
d8ab4a
-- 
d8ab4a
1.8.3.1
d8ab4a