Blame SOURCES/kvm-tcp_emu-Fix-oob-access.patch

8b1478
From 66013de2e0075ae67edd31efb3e86c728ec485fa Mon Sep 17 00:00:00 2001
8b1478
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@redhat.com>
8b1478
Date: Fri, 17 Jan 2020 11:49:40 +0100
8b1478
Subject: [PATCH 1/3] tcp_emu: Fix oob access
8b1478
MIME-Version: 1.0
8b1478
Content-Type: text/plain; charset=UTF-8
8b1478
Content-Transfer-Encoding: 8bit
8b1478
8b1478
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
8b1478
Message-id: <20200117114942.12236-2-philmd@redhat.com>
8b1478
Patchwork-id: 93393
8b1478
O-Subject: [RHEL-7.7.z qemu-kvm-rhev + RHEL-7.8 qemu-kvm-rhev + RHEL-7.9 qemu-kvm-rhev + RHEL-8.1.0 qemu-kvm + RHEL-8.2.0 qemu-kvm + RHEL-7.7.z qemu-kvm-ma + RHEL-7.8 qemu-kvm-ma + RHEL-7.9 qemu-kvm-ma PATCH 1/3] tcp_emu: Fix oob access
8b1478
Bugzilla: 1791563 1791570
8b1478
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
8b1478
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
8b1478
RH-Acked-by: Thomas Huth <thuth@redhat.com>
8b1478
8b1478
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
8b1478
8b1478
The main loop only checks for one available byte, while we sometimes
8b1478
need two bytes.
8b1478
8b1478
(cherry picked from libslirp commit 2655fffed7a9e765bcb4701dd876e9dab975f289)
8b1478
[PMD: backported with style conflicts,
8b1478
      CHANGELOG.md absent in downstream]
8b1478
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8b1478
8b1478
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
8b1478
---
8b1478
 slirp/tcp_subr.c | 7 +++++++
8b1478
 1 file changed, 7 insertions(+)
8b1478
8b1478
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
8b1478
index 0152f72..decfd9b 100644
8b1478
--- a/slirp/tcp_subr.c
8b1478
+++ b/slirp/tcp_subr.c
8b1478
@@ -892,6 +892,9 @@ tcp_emu(struct socket *so, struct mbuf *m)
8b1478
 				break;
8b1478
 
8b1478
 			 case 5:
8b1478
+				if (bptr == m->m_data + m->m_len - 1)
8b1478
+					return 1; /* We need two bytes */
8b1478
+
8b1478
 				/*
8b1478
 				 * The difference between versions 1.0 and
8b1478
 				 * 2.0 is here. For future versions of
8b1478
@@ -907,6 +910,10 @@ tcp_emu(struct socket *so, struct mbuf *m)
8b1478
 				/* This is the field containing the port
8b1478
 				 * number that RA-player is listening to.
8b1478
 				 */
8b1478
+
8b1478
+				if (bptr == m->m_data + m->m_len - 1)
8b1478
+					return 1; /* We need two bytes */
8b1478
+
8b1478
 				lport = (((u_char*)bptr)[0] << 8)
8b1478
 				+ ((u_char *)bptr)[1];
8b1478
 				if (lport < 6970)
8b1478
-- 
8b1478
1.8.3.1
8b1478