From 42ec1625849cad67f1aa59eadfdd0946b230668a Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Tue, 11 Feb 2020 11:49:43 +0100 Subject: [PATCH] test/fuzz: start with att_db --- test/fuzz/fuzz_att_db.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/fuzz/fuzz_att_db.c diff --git a/test/fuzz/fuzz_att_db.c b/test/fuzz/fuzz_att_db.c new file mode 100644 index 000000000..994059381 --- /dev/null +++ b/test/fuzz/fuzz_att_db.c @@ -0,0 +1,26 @@ +#include +#include +#include + +#include +#include + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + static int initialized = 0; + if (initialized == 0){ + initialized = 1; + // setup empty db + att_db_util_init(); + uint8_t * att_db = att_db_util_get_address(); + // setup att_db + att_set_db(att_db); + } + + // TODO: setup att_connection + att_connection_t att_connection = { 0 }; + uint8_t att_response[1000]; + uint16_t att_request_len = size; + const uint8_t * att_request = data; + uint16_t att_respnose_len = att_handle_request(&att_connection, (uint8_t *) att_request, att_request_len, att_response); + return 0; +}