From e4cac595c2b8b187a8fb2c9c2dcc1373c31e12a2 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 18 Feb 2016 09:36:55 +0100 Subject: [PATCH] Check TCP_SNDLOWAT for too high value (near u16_t overflow) - fixes bug #46948 --- src/core/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/init.c b/src/core/init.c index 3b78a8a1..99419df7 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -288,6 +288,9 @@ #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_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS)) + #error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must at least be 4*MSS below u16_t overflow!" +#endif #if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN #error "lwip_sanity_check: WARNING: TCP_SNDQUEUELOWAT must be less than TCP_SND_QUEUELEN. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." #endif