/src/ndpi/fuzz/fuzz_filecfg_risk_domains.c
Line | Count | Source |
1 | | #include "ndpi_api.h" |
2 | | #include "ndpi_private.h" |
3 | | #include "fuzz_common_code.h" |
4 | | |
5 | 1.74k | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
6 | 1.74k | struct ndpi_detection_module_struct *ndpi_struct; |
7 | 1.74k | FILE *fd; |
8 | | |
9 | | /* To allow memory allocation failures */ |
10 | 1.74k | fuzz_set_alloc_callbacks_and_seed(size); |
11 | | |
12 | 1.74k | ndpi_struct = ndpi_init_detection_module(NULL); |
13 | | |
14 | 1.74k | ndpi_set_config(ndpi_struct, NULL, "log.level", "3"); |
15 | 1.74k | ndpi_set_config(ndpi_struct, "all", "log", "1"); |
16 | | |
17 | 1.74k | fd = buffer_to_file(data, size); |
18 | 1.74k | load_risk_domain_file_fd(ndpi_struct, fd); |
19 | 1.74k | if(fd) |
20 | 1.74k | fclose(fd); |
21 | | |
22 | 1.74k | ndpi_exit_detection_module(ndpi_struct); |
23 | 1.74k | return 0; |
24 | 1.74k | } |