diff options
-rw-r--r-- | slirp/tcp_subr.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; |