diff options
Diffstat (limited to 'src/tests/fuzz/fuzz_confyamlloadstring.c')
-rw-r--r-- | src/tests/fuzz/fuzz_confyamlloadstring.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tests/fuzz/fuzz_confyamlloadstring.c b/src/tests/fuzz/fuzz_confyamlloadstring.c new file mode 100644 index 0000000..f5f9ed3 --- /dev/null +++ b/src/tests/fuzz/fuzz_confyamlloadstring.c @@ -0,0 +1,31 @@ +/** + * @file + * @author Philippe Antoine <contact@catenacyber.fr> + * fuzz target for ConfYamlLoadString + */ + + +#include "suricata-common.h" +#include "suricata.h" +#include "conf-yaml-loader.h" + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); + +static int initialized = 0; + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + if (initialized == 0) { + //Redirects logs to /dev/null + setenv("SC_LOG_OP_IFACE", "file", 0); + setenv("SC_LOG_FILE", "/dev/null", 0); + //global init + InitGlobal(); + run_mode = RUNMODE_UNITTEST; + initialized = 1; + } + + ConfYamlLoadString((const char *) data, size); + + return 0; +} |