837c7a8012
a few fixes. OBS-URL: https://build.opensuse.org/request/show/668736 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=450
34 lines
1.2 KiB
Diff
34 lines
1.2 KiB
Diff
From: Prasad J Pandit <pjp@fedoraproject.org>
|
|
Date: Sun, 13 Jan 2019 23:29:48 +0530
|
|
Subject: slirp: check data length while emulating ident function
|
|
|
|
While emulating identification protocol, tcp_emu() does not check
|
|
available space in the 'sc_rcv->sb_data' buffer. It could lead to
|
|
heap buffer overflow issue. Add check to avoid it.
|
|
|
|
Reported-by: Kira <864786842@qq.com>
|
|
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
|
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
(cherry picked from commit a7104eda7dab99d0cdbd3595c211864cba415905)
|
|
[BR: BSC#1123156 CVE-2019-6778, modify patch to use spaces instead of tabs]
|
|
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
|
---
|
|
slirp/tcp_subr.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
|
|
index fa61349cbb..7a23ce738c 100644
|
|
--- a/slirp/tcp_subr.c
|
|
+++ b/slirp/tcp_subr.c
|
|
@@ -635,6 +635,10 @@ tcp_emu(struct socket *so, struct mbuf *m)
|
|
socklen_t addrlen = sizeof(struct sockaddr_in);
|
|
struct sbuf *so_rcv = &so->so_rcv;
|
|
|
|
+ if (m->m_len > so_rcv->sb_datalen - (so_rcv->sb_wptr - so_rcv->sb_data)) {
|
|
+ return 1;
|
|
+ }
|
|
+
|
|
memcpy(so_rcv->sb_wptr, m->m_data, m->m_len);
|
|
so_rcv->sb_wptr += m->m_len;
|
|
so_rcv->sb_rptr += m->m_len;
|