diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index ec42164..f595ef8 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -1141,7 +1141,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb) if (seg->flags & TF_SEG_OPTS_WND_SCALE) { /* The Window field in a SYN segment itself (the only type where we send the window scale option) is never scaled. */ - seg->tcphdr->wnd = htons(pcb->rcv_ann_wnd); + seg->tcphdr->wnd = htons(LWIP_MIN(pcb->rcv_ann_wnd, 65535U)); } else #endif /* LWIP_WND_SCALE */ {