Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
qemu.30219
0115-slirp-use-correct-size-while-emulat.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0115-slirp-use-correct-size-while-emulat.patch of Package qemu.30219
From: Prasad J Pandit <pjp@fedoraproject.org> Date: Thu, 9 Jan 2020 15:12:28 +0530 Subject: slirp: use correct size while emulating commands Git-commit: 82ebe9c370a0e2970fb5695aa19aa5214a6a1c80 References: bsc#1161066, CVE-2020-7039, bsc#1163018, CVE-2020-8608 While emulating services in tcp_emu(), it uses 'mbuf' size 'm->m_size' to write commands via snprintf(3). Use M_FREEROOM(m) size to avoid possible OOB access. Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-Id: <20200109094228.79764-3-ppandit@redhat.com> [Since porting from a quite different now libslirp, quite a bit changed] Signed-off-by: Bruce Rogers <brogers@suse.com> --- slirp/tcp_subr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 1429f27d716db2d8bac454cc3ea3..fe801b6b54252f0062123cb93481 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -699,7 +699,7 @@ tcp_emu(struct socket *so, struct mbuf *m) n4 = (laddr & 0xff); m->m_len = bptr - m->m_data; /* Adjust length */ - m->m_len += snprintf(bptr, m->m_size - m->m_len, + m->m_len += snprintf(bptr, M_FREEROOM(m), "ORT %d,%d,%d,%d,%d,%d\r\n%s", n1, n2, n3, n4, n5, n6, x==7?buff:""); return 1; @@ -732,7 +732,7 @@ tcp_emu(struct socket *so, struct mbuf *m) n4 = (laddr & 0xff); m->m_len = bptr - m->m_data; /* Adjust length */ - m->m_len += snprintf(bptr, m->m_size - m->m_len, + m->m_len += snprintf(bptr, M_FREEROOM(m), "27 Entering Passive Mode (%d,%d,%d,%d,%d,%d)\r\n%s", n1, n2, n3, n4, n5, n6, x==7?buff:""); @@ -758,7 +758,7 @@ tcp_emu(struct socket *so, struct mbuf *m) if (m->m_data[m->m_len-1] == '\0' && lport != 0 && (so = tcp_listen(slirp, INADDR_ANY, 0, so->so_laddr.s_addr, htons(lport), SS_FACCEPTONCE)) != NULL) - m->m_len = snprintf(m->m_data, m->m_size, "%d", + m->m_len = snprintf(m->m_data, M_ROOM(m), "%d", ntohs(so->so_fport)) + 1; return 1;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor