Commit 3c7454d4 authored by Michael Tokarev's avatar Michael Tokarev

slirp-check-data-length-while-emulating-ident-function-CVE-2019-6778.patch (#921525)

parent 059e0bb0
......@@ -6,3 +6,4 @@ hw_usb-fix-mistaken-de-initialization-of-CCID-state.patch
sparc64-timeval.tv_usec-is-int.patch
scsi-generic-avoid-possible-oob-access-to-r-buf-CVE-2019-6501.patch
pvrdma-release-device-resources-on-error-CVE-2018-20123.patch
slirp-check-data-length-while-emulating-ident-function-CVE-2019-6778.patch
Commit-Id: a7104eda7dab99d0cdbd3595c211864cba415905
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 (CVE-2019-6778)
Bug-Debian: http://bugs.debian.org/921525
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>
---
slirp/tcp_subr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 4a9a5b5edc..23a841f26e 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -634,6 +634,11 @@ 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;
--
2.11.0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment