fix for null deref in slirp soread when the so doesn't have a tcpcb yet

This commit is contained in:
Andrew Tonner 2017-01-20 02:05:55 -08:00
parent 52a36f24bb
commit 68353ca6b1

View File

@ -108,6 +108,10 @@ soread(so)
struct sbuf *sb = &so->so_snd; struct sbuf *sb = &so->so_snd;
u_int len = sb->sb_datalen - sb->sb_cc; u_int len = sb->sb_datalen - sb->sb_cc;
struct iovec iov[2]; struct iovec iov[2];
if (!so->so_tcpcb) {
so->so_tcpcb = tcp_newtcpcb(so); // but how did we get in this state? should we just default mss for it?
}
u_int mss = so->so_tcpcb->t_maxseg; u_int mss = so->so_tcpcb->t_maxseg;
DEBUG_CALL("soread"); DEBUG_CALL("soread");