slirp: check data length while emulating ident function
PATCH v2 1/1 slirp: check data length while emulating ident function
From: Prasad J Pandit <[email protected]>
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 <[email protected]>
Signed-off-by Prasad J Pandit <[email protected]>
--- slirp/tcp_subr.c | 4 ++++ 1 file changed, 4 insertions(+)
Update v2: return 1 instead of 0
-> https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg02182.html
slirp/tcp_subr.c +4 -0
@@ -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;
Signature · 1 line
2.20.1
Samuel Thibault
AppliedP J P, le dim. 13 janv. 2019 23:29:48 +0530, a ecrit:
Quoted 8 lines
From: Prasad J Pandit <[email protected]>
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 <[email protected]>Signed-off-by Prasad J Pandit <[email protected]>
Applied to my tree, thanks!
Samuel