From e5f714575ec96241cb0740f31e63b48874cf0624 Mon Sep 17 00:00:00 2001 From: Ruslan Mstoi Date: Wed, 1 Apr 2020 13:50:44 +0300 Subject: [PATCH] net: tcp2: Fix handling of the END TCP option End option indicates the end of the option list. Hence, correct way to handle it is to break out of the option parsing routine. Signed-off-by: Ruslan Mstoi --- subsys/net/ip/tcp2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subsys/net/ip/tcp2.c b/subsys/net/ip/tcp2.c index fc1eadef21c..7396d295258 100644 --- a/subsys/net/ip/tcp2.c +++ b/subsys/net/ip/tcp2.c @@ -387,7 +387,9 @@ static bool tcp_options_check(void *buf, ssize_t len) NET_DBG("opt: %hu, opt_len: %hu", (u16_t)opt, (u16_t)opt_len); - if (opt == TCPOPT_END || opt == TCPOPT_NOP) { + if (opt == TCPOPT_END) { + break; + } else if (opt == TCPOPT_NOP) { continue; }