Skip to content

Commit

Permalink
fixup! tests/nanocoap: add test for option parse overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Jan 14, 2019
1 parent c4bad62 commit 8b86050
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/unittests/tests-nanocoap/tests-nanocoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,13 @@ static void test_nanocoap__server_reply_simple_con(void)
static void test_nanocoap__server_option_count_overflow_check(void)
{
/* this test passes a forged CoAP packet containing 42 options (provided by
* @nmeum in #10753) to coap_parse(). The used coap_pkt_t is part of a
* struct, followed by an array of 42 coap_option_t. The array is cleared
* before the call to coap_parse(). If the overflow protection is working,
* the array must still be clear after parsing the packet, and the proper
* error code (-ENOMEM) is returned. Otherwise, the parsing wrote past
* scratch.pkt, thus the array is not zeroed anymore.
* @nmeum in #10753, 42 is a random number which just needs to be higher
* than NANOCOAP_NOPTS_MAX) to coap_parse(). The used coap_pkt_t is part
* of a struct, followed by an array of 42 coap_option_t. The array is
* cleared before the call to coap_parse(). If the overflow protection is
* working, the array must still be clear after parsing the packet, and the
* proper error code (-ENOMEM) is returned. Otherwise, the parsing wrote
* past scratch.pkt, thus the array is not zeroed anymore.
*/

static uint8_t pkt_data[] = {
Expand Down

0 comments on commit 8b86050

Please sign in to comment.