gnrc_tcp: check if option has valid length set

This commit is contained in:
Martine Lenders 2019-10-03 18:30:40 +02:00
parent e9e0001239
commit 66e5f7230f

View File

@ -69,7 +69,8 @@ int _option_parse(gnrc_tcp_tcb_t *tcb, tcp_hdr_t *hdr)
} }
} }
if (opt_left < TCP_OPTION_LENGTH_MIN || option->length > opt_left) { if ((opt_left < TCP_OPTION_LENGTH_MIN) || (option->length > opt_left) ||
(option->length < TCP_OPTION_LENGTH_MIN)) {
DEBUG("gnrc_tcp_option.c : _option_parse() : Invalid option. Drop Packet.\n"); DEBUG("gnrc_tcp_option.c : _option_parse() : Invalid option. Drop Packet.\n");
return -1; return -1;
} }