slirp: more changes to prevent a crash in the soread without so_tcpcb case

This commit is contained in:
Andrew Tonner 2017-01-20 13:27:00 -08:00
parent 68353ca6b1
commit bab9820231
2 changed files with 5 additions and 2 deletions

View File

@ -219,7 +219,7 @@ int slirp_select_fill(int *pnfds,
/*
* See if we need a tcp_fasttimo
*/
if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK)
if (time_fasttimo == 0 && so->so_tcpcb && so->so_tcpcb->t_flags & TF_DELACK)
time_fasttimo = curtime; /* Flag when we want a fasttimo */
/*

View File

@ -110,7 +110,10 @@ soread(so)
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?
// how did we get in this state?
tcp_newtcpcb(so);
// from what I've seen while debugging, the socket struct is about to get freed, so consider it closed.
return -1;
}
u_int mss = so->so_tcpcb->t_maxseg;