From 8e8571da6a6771f9d2d82bbd0b5a6c27474ce0fc Mon Sep 17 00:00:00 2001 From: sg Date: Wed, 16 Mar 2016 16:56:15 +0100 Subject: [PATCH] fixed bug #46384 Segment size calculation bug with MSS != TCP_MSS --- CHANGELOG | 5 ++++- src/core/tcp_out.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 21a85c94..b427d9c4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,7 +6,7 @@ HISTORY ++ New features: - 2016-02-22: Ivan Delamer: + 2016-02-22: Ivan Delamer * Initial 6LoWPAN support 2015-12-26: Martin Hentschel and Dirk Ziegelmeier @@ -302,6 +302,9 @@ HISTORY ++ Bugfixes: + 2016-03-16: Deomid Ryabkov + * tcp_out.c: fixed bug #46384 Segment size calculation bug with MSS != TCP_MSS + 2016-03-05: Simon Goldschmidt * err.h/.c, sockets.c: ERR_IF is not necessarily a fatal error diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index fa8d77fb..a7b05954 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -469,7 +469,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) if (oversize > 0) { LWIP_ASSERT("inconsistent oversize vs. space", oversize_used <= space); seg = last_unsent; - oversize_used = oversize < len ? oversize : len; + oversize_used = LWIP_MIN(space, LWIP_MIN(oversize, len)); pos += oversize_used; oversize -= oversize_used; space -= oversize_used;