1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2026-01-01 01:41:18 +01:00

Merge pull request #12088 from nmeum/pr/gnrc_tcp_option_overflow

gnrc_tcp: fix integer underflow in option parser
This commit is contained in:
benpicco 2019-08-30 17:34:39 +02:00 committed by GitHub
commit 7d3f20b1a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,6 +64,12 @@ int _option_parse(gnrc_tcp_tcb_t *tcb, tcp_hdr_t *hdr)
DEBUG("gnrc_tcp_option.c : _option_parse() : Unknown option found.\
KIND=%"PRIu8", LENGTH=%"PRIu8"\n", option->kind, option->length);
}
if (option->length > opt_left) {
DEBUG("gnrc_tcp_option.c : _option_parse() : invalid option length\n");
return 0;
}
opt_ptr += option->length;
opt_left -= option->length;
}