From f1ed8c8a2e82dd4026d4a17a8356da314a91711e Mon Sep 17 00:00:00 2001 From: Daniel Campora Date: Tue, 28 Apr 2015 16:38:08 +0200 Subject: [PATCH] cc3200: Improve telnet_parse_input() in case of an incomplete option. --- cc3200/telnet/telnet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cc3200/telnet/telnet.c b/cc3200/telnet/telnet.c index b96a09521e..f6d93f8d78 100644 --- a/cc3200/telnet/telnet.c +++ b/cc3200/telnet/telnet.c @@ -468,8 +468,9 @@ static void telnet_parse_input (uint8_t *str, int16_t *len) { } } else { - _str += 3; - *len -= 3; + // in case we have received an incomplete telnet option, unlikely, but possible + _str += MIN(3, *len); + *len -= MIN(3, *len); } } }