slirp: check data length while emulating ident function
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>
This commit is contained in:
parent
55ef9c617b
commit
a7104eda7d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user