2020-05-12 10:31:40 +08:00
|
|
|
From 585634894f511bc1821cef54494bf2d9abc109c9 Mon Sep 17 00:00:00 2001
|
2020-03-11 19:12:43 +08:00
|
|
|
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
2020-05-12 10:31:40 +08:00
|
|
|
Date: Tue, 14 Apr 2020 18:04:33 +0800
|
2020-03-11 19:12:43 +08:00
|
|
|
Subject: [PATCH] tcp_emu: Fix oob access
|
|
|
|
|
|
|
|
|
|
The main loop only checks for one available byte, while we sometimes
|
|
|
|
|
need two bytes.
|
|
|
|
|
---
|
|
|
|
|
slirp/src/tcp_subr.c | 6 ++++++
|
|
|
|
|
1 file changed, 6 insertions(+)
|
|
|
|
|
|
|
|
|
|
diff --git a/slirp/src/tcp_subr.c b/slirp/src/tcp_subr.c
|
2020-05-12 10:31:40 +08:00
|
|
|
index d6dd133a..9c94c03a 100644
|
2020-03-11 19:12:43 +08:00
|
|
|
--- a/slirp/src/tcp_subr.c
|
|
|
|
|
+++ b/slirp/src/tcp_subr.c
|
2020-05-12 10:31:40 +08:00
|
|
|
@@ -886,6 +886,9 @@ int tcp_emu(struct socket *so, struct mbuf *m)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
+ if (bptr == m->m_data + m->m_len - 1)
|
|
|
|
|
+ return 1; /* We need two bytes */
|
2020-03-11 19:12:43 +08:00
|
|
|
+
|
2020-05-12 10:31:40 +08:00
|
|
|
/*
|
|
|
|
|
* The difference between versions 1.0 and
|
|
|
|
|
* 2.0 is here. For future versions of
|
|
|
|
|
@@ -901,6 +904,9 @@ int tcp_emu(struct socket *so, struct mbuf *m)
|
|
|
|
|
/* This is the field containing the port
|
|
|
|
|
* number that RA-player is listening to.
|
|
|
|
|
*/
|
|
|
|
|
+ if (bptr == m->m_data + m->m_len - 1)
|
|
|
|
|
+ return 1; /* We need two bytes */
|
2020-03-11 19:12:43 +08:00
|
|
|
+
|
2020-05-12 10:31:40 +08:00
|
|
|
lport = (((uint8_t *)bptr)[0] << 8) + ((uint8_t *)bptr)[1];
|
|
|
|
|
if (lport < 6970)
|
|
|
|
|
lport += 256; /* don't know why */
|
|
|
|
|
--
|
|
|
|
|
2.23.0
|