tcp: Fix ooseq processing when seqno is near 2^32

An edge case in out-of-sequence TCP packet processing did not use the
appropriate macro to check if the sender overran the recieve window.

Consequently, this case sometimes evaluated to true when it shouldn't, which
resulted in various bad behavior, including trying to resize a TCP buffer to 4
gigabytes.
This commit is contained in:
Clint Sbisa
2015-02-11 12:18:08 -08:00
committed by goldsimon
parent 94f7bcef67
commit 32f6e7e231
2 changed files with 95 additions and 1 deletions

View File

@@ -1581,7 +1581,7 @@ tcp_receive(struct tcp_pcb *pcb)
pbuf_realloc(next->p, next->len);
}
/* check if the remote side overruns our receive window */
if ((u32_t)tcplen + seqno > pcb->rcv_nxt + (u32_t)pcb->rcv_wnd) {
if (TCP_SEQ_GT((u32_t)tcplen + seqno, pcb->rcv_nxt + (u32_t)pcb->rcv_wnd)) {
LWIP_DEBUGF(TCP_INPUT_DEBUG,
("tcp_receive: other end overran receive window"
"seqno %"U32_F" len %"U16_F" right edge %"U32_F"\n",