From 0d78658ded47beeffccf5f91cefaf249250fd2de Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Mon, 2 Jul 2018 13:43:48 +0200 Subject: [PATCH] pdu_parse_target: Add coap_show_pdu to test case oss-fuzz: Added split_uri target oss-fuzz: Update usage of coap_show_pdu() in pdu_parse_target oss-fuzz: Fix split uri issue mentioned in #218 oss-fuzz: Set log level --- tests/oss-fuzz/pdu_parse_target.c | 2 ++ tests/oss-fuzz/split_uri_target.c | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 tests/oss-fuzz/split_uri_target.c diff --git a/tests/oss-fuzz/pdu_parse_target.c b/tests/oss-fuzz/pdu_parse_target.c index f8a0702c..ee770001 100644 --- a/tests/oss-fuzz/pdu_parse_target.c +++ b/tests/oss-fuzz/pdu_parse_target.c @@ -4,7 +4,9 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { coap_pdu_t *pdu = coap_pdu_init(0, 0, 0, size); if (pdu) { + coap_set_log_level(LOG_DEBUG); coap_pdu_parse(COAP_PROTO_UDP, data, size, pdu); + coap_show_pdu(LOG_DEBUG, pdu); coap_delete_pdu(pdu); } return 0; diff --git a/tests/oss-fuzz/split_uri_target.c b/tests/oss-fuzz/split_uri_target.c new file mode 100644 index 00000000..946618ff --- /dev/null +++ b/tests/oss-fuzz/split_uri_target.c @@ -0,0 +1,8 @@ +#include + +int +LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + coap_uri_t uri; + coap_split_uri(data, size, &uri); + return 0; +}