|
|
016a62 |
From 64f43842f5685d5b1290d4a1bf4eba8e1e738a8d Mon Sep 17 00:00:00 2001
|
|
|
d8ab4a |
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@redhat.com>
|
|
|
016a62 |
Date: Fri, 17 Jan 2020 11:49:41 +0100
|
|
|
016a62 |
Subject: [PATCH 6/7] slirp: use correct size while emulating IRC commands
|
|
|
d8ab4a |
MIME-Version: 1.0
|
|
|
d8ab4a |
Content-Type: text/plain; charset=UTF-8
|
|
|
d8ab4a |
Content-Transfer-Encoding: 8bit
|
|
|
d8ab4a |
|
|
|
d8ab4a |
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
d8ab4a |
Message-id: <20200117114942.12236-3-philmd@redhat.com>
|
|
|
d8ab4a |
Patchwork-id: 93392
|
|
|
d8ab4a |
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 2/3] slirp: use correct size while emulating IRC commands
|
|
|
016a62 |
Bugzilla: 1791566
|
|
|
d8ab4a |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
016a62 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
016a62 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
d8ab4a |
|
|
|
d8ab4a |
From: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
d8ab4a |
|
|
|
d8ab4a |
While emulating IRC DCC commands, tcp_emu() uses 'mbuf' size
|
|
|
d8ab4a |
'm->m_size' to write DCC commands via snprintf(3). This may
|
|
|
d8ab4a |
lead to OOB write access, because 'bptr' points somewhere in
|
|
|
d8ab4a |
the middle of 'mbuf' buffer, not at the start. Use M_FREEROOM(m)
|
|
|
d8ab4a |
size to avoid OOB access.
|
|
|
d8ab4a |
|
|
|
d8ab4a |
Reported-by: Vishnu Dev TJ <vishnudevtj@gmail.com>
|
|
|
d8ab4a |
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
d8ab4a |
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
|
d8ab4a |
Message-Id: <20200109094228.79764-2-ppandit@redhat.com>
|
|
|
d8ab4a |
(cherry picked from libslirp commit ce131029d6d4a405cb7d3ac6716d03e58fb4a5d9)
|
|
|
d8ab4a |
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
d8ab4a |
|
|
|
016a62 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
d8ab4a |
---
|
|
|
d8ab4a |
slirp/tcp_subr.c | 6 +++---
|
|
|
d8ab4a |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
d8ab4a |
|
|
|
d8ab4a |
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
|
|
|
d8ab4a |
index decfd9b..b60310d 100644
|
|
|
d8ab4a |
--- a/slirp/tcp_subr.c
|
|
|
d8ab4a |
+++ b/slirp/tcp_subr.c
|
|
|
d8ab4a |
@@ -783,7 +783,7 @@ tcp_emu(struct socket *so, struct mbuf *m)
|
|
|
d8ab4a |
return 1;
|
|
|
d8ab4a |
}
|
|
|
d8ab4a |
m->m_len = bptr - m->m_data; /* Adjust length */
|
|
|
d8ab4a |
- m->m_len += snprintf(bptr, m->m_size,
|
|
|
d8ab4a |
+ m->m_len += snprintf(bptr, M_FREEROOM(m),
|
|
|
d8ab4a |
"DCC CHAT chat %lu %u%c\n",
|
|
|
d8ab4a |
(unsigned long)ntohl(so->so_faddr.s_addr),
|
|
|
d8ab4a |
ntohs(so->so_fport), 1);
|
|
|
d8ab4a |
@@ -794,7 +794,7 @@ tcp_emu(struct socket *so, struct mbuf *m)
|
|
|
d8ab4a |
return 1;
|
|
|
d8ab4a |
}
|
|
|
d8ab4a |
m->m_len = bptr - m->m_data; /* Adjust length */
|
|
|
d8ab4a |
- m->m_len += snprintf(bptr, m->m_size,
|
|
|
d8ab4a |
+ m->m_len += snprintf(bptr, M_FREEROOM(m),
|
|
|
d8ab4a |
"DCC SEND %s %lu %u %u%c\n", buff,
|
|
|
d8ab4a |
(unsigned long)ntohl(so->so_faddr.s_addr),
|
|
|
d8ab4a |
ntohs(so->so_fport), n1, 1);
|
|
|
d8ab4a |
@@ -805,7 +805,7 @@ tcp_emu(struct socket *so, struct mbuf *m)
|
|
|
d8ab4a |
return 1;
|
|
|
d8ab4a |
}
|
|
|
d8ab4a |
m->m_len = bptr - m->m_data; /* Adjust length */
|
|
|
d8ab4a |
- m->m_len += snprintf(bptr, m->m_size,
|
|
|
d8ab4a |
+ m->m_len += snprintf(bptr, M_FREEROOM(m),
|
|
|
d8ab4a |
"DCC MOVE %s %lu %u %u%c\n", buff,
|
|
|
d8ab4a |
(unsigned long)ntohl(so->so_faddr.s_addr),
|
|
|
d8ab4a |
ntohs(so->so_fport), n1, 1);
|
|
|
d8ab4a |
--
|
|
|
d8ab4a |
1.8.3.1
|
|
|
d8ab4a |
|