From e5d0c07f5b15017498215a9b1e5bc5dade42c499 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 6 Feb 2018 16:53:46 -0800 Subject: [PATCH] Added check for bad segments in fast retransmit. Attempted fix for tcp_out.c:1148 bug --- ext/lwip/src/core/tcp_out.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/lwip/src/core/tcp_out.c b/ext/lwip/src/core/tcp_out.c index babc67f..27b4958 100755 --- a/ext/lwip/src/core/tcp_out.c +++ b/ext/lwip/src/core/tcp_out.c @@ -1145,6 +1145,11 @@ tcp_output(struct tcp_pcb *pcb) /* In the case of fast retransmit, the packet should not go to the tail * of the unacked queue, but rather somewhere before it. We need to check for * this case. -STJ Jul 27, 2004 */ + if (seg == NULL || useg != NULL) + { + LWIP_DEBUGF(TCP_DEBUG, ("seg or useg was null, skipping this packet\n")); + return ERR_OK; + } if (TCP_SEQ_LT(lwip_ntohl(seg->tcphdr->seqno), lwip_ntohl(useg->tcphdr->seqno))) { /* add segment to before tail of unacked list, keeping the list sorted */ struct tcp_seg **cur_seg = &(pcb->unacked);