diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index f8f4b9c1..a9f58ae1 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -363,7 +363,13 @@ tcp_output(struct tcp_pcb *pcb) seg = pcb->unsent; - useg = pcb->unacked; + + /* useg should point to last segment on unacked queue */ + useg = pcb->unacked; + if (useg != NULL) { + for (; useg->next != NULL; useg = useg->next); + } + /* If the TF_ACK_NOW flag is set, we check if there is data that is to be sent. If data is to be sent out, we'll just piggyback our