thebeanogamer / rpms / qemu-kvm

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