1 #include <coap3/coap.h>
2
3 /* Declare prototype for internal function coap_pdu_encode_header() */
4 size_t coap_pdu_encode_header(coap_pdu_t *, coap_proto_t);
5
6 int
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)7 LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
8 coap_pdu_t *pdu = coap_pdu_init(0, 0, 0, size);
9 if (pdu) {
10 coap_set_log_level(COAP_LOG_ERR);
11 if (coap_pdu_parse(COAP_PROTO_TCP, data, size, pdu)) {
12 coap_string_t *query = coap_get_query(pdu);
13 coap_string_t *uri_path = coap_get_uri_path(pdu);
14 coap_show_pdu(COAP_LOG_ERR, pdu);
15 coap_pdu_encode_header(pdu, COAP_PROTO_TCP);
16
17 coap_delete_string(query);
18 coap_delete_string(uri_path);
19 }
20 coap_delete_pdu(pdu);
21 }
22 return 0;
23 }
24