From a352f4e11ceb99448f6ba3aeca6ae364befe0fcb Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Fri, 26 Oct 2018 19:43:13 +0200 Subject: [PATCH] Explicitly check for TCP_MSS to be <= ~16 kByte See bug #54890 Signed-off-by: Simon Goldschmidt --- src/core/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/init.c b/src/core/init.c index 5e19a98a..1f658676 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -305,6 +305,9 @@ PACK_STRUCT_END #if TCP_SNDLOWAT >= TCP_SND_BUF #error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." #endif +#if TCP_MSS >= ((16 * 1024) - 1) +#error "lwip_sanity_check: WARNING: TCP_MSS must be <= 16382 to prevent u16_t underflow in TCP_SNDLOWAT calculation!" +#endif #if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS)) #error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must at least be 4*MSS below u16_t overflow!" #endif