diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 913951d4..1268276d 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -1544,9 +1544,12 @@ tcp_receive(struct tcp_pcb *pcb) if (next && TCP_SEQ_GT(seqno + tcplen, next->tcphdr->seqno)) { - /* inseg cannot have FIN here (already processed above) */ inseg.len = (u16_t)(next->tcphdr->seqno - seqno); +#if ESP_LWIP + if (TCPH_FLAGS(inseg.tcphdr) & TCP_SYN || TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) { +#else if (TCPH_FLAGS(inseg.tcphdr) & TCP_SYN) { +#endif inseg.len -= 1; } pbuf_realloc(inseg.p, inseg.len);