fuzzing REFACTOR fuzz harneses (#1126)
Fix minor issues with implicit function declarations, terminate fuzzer
string inputs with string termination characters and add an XML parser
harness
diff --git a/tests/fuzz/yang_parse_module.c b/tests/fuzz/yang_parse_module.c
index 4b464a7..595da62 100644
--- a/tests/fuzz/yang_parse_module.c
+++ b/tests/fuzz/yang_parse_module.c
@@ -5,10 +5,12 @@
#include "../../src/common.h"
#include "../../src/tree_schema_internal.h"
+LY_ERR yang_parse_module(struct lys_yang_parser_ctx **context, const char *data, struct lys_module *mod);
+
int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
{
struct lys_module *mod = NULL;
- struct lys_parser_ctx *context = NULL;
+ struct lys_yang_parser_ctx *context = NULL;
uint8_t *data = NULL;
struct ly_ctx *ctx = NULL;
static bool log = false;
@@ -30,8 +32,8 @@
fprintf(stderr, "Out of memory\n");
return 0;
}
- data[len] = 0;
memcpy(data, buf, len);
+ data[len] = 0;
mod = calloc(1, sizeof *mod);
if (mod == NULL) {