[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 65/65] slirp: check data length while emulating ident
From: |
Samuel Thibault |
Subject: |
[Qemu-devel] [PULL 65/65] slirp: check data length while emulating ident function |
Date: |
Mon, 14 Jan 2019 01:03:26 +0100 |
From: Prasad J Pandit <address@hidden>
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 <address@hidden>
Signed-off-by: Prasad J Pandit <address@hidden>
Signed-off-by: Samuel Thibault <address@hidden>
---
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.20.1
- [Qemu-devel] [PULL 58/65] slirp: replace DEBUG_ARGS with DEBUG_ARG, (continued)
- [Qemu-devel] [PULL 58/65] slirp: replace DEBUG_ARGS with DEBUG_ARG, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 63/65] slirp: call into g_debug() for DEBUG macros, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 55/65] slirp: introduce SLIRP_DEBUG environment variable, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 52/65] slirp: replace a DEBUG block with WITH_ICMP_ERROR_MSG, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 51/65] slirp: replace some fprintf() with DEBUG_MISC, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 54/65] slirp: always build with debug statements, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 56/65] slirp: use %p for pointers format, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 48/65] slirp: rename exec_list, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 57/65] slirp: remove remaining DEBUG blocks, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 64/65] slirp: Mark debugging calls as unlikely, Samuel Thibault, 2019/01/13
- [Qemu-devel] [PULL 65/65] slirp: check data length while emulating ident function,
Samuel Thibault <=
- [Qemu-devel] [PULL 61/65] build-sys: use a seperate slirp-obj-y && slirp.mo, Samuel Thibault, 2019/01/13
- Re: [Qemu-devel] [PULLv2 00/65] slirp updates, no-reply, 2019/01/13
- Re: [Qemu-devel] [PULLv2 00/65] slirp updates, no-reply, 2019/01/14