nDPI/fuzz/fuzz_filecfg_categories.c
2026-08-25 16:58:08 +02:00

24 lines
660 B
C

#include "ndpi_api.h"
#include "ndpi_private.h"
#include "fuzz_common_code.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
struct ndpi_detection_module_struct *ndpi_struct;
FILE *fd;
/* To allow memory allocation failures */
fuzz_set_alloc_callbacks_and_seed(size);
ndpi_struct = ndpi_init_detection_module(NULL, NDPI_LICENSE_NOT_FOR_PROFIT_LGPL);
ndpi_set_config_u64(ndpi_struct, NULL, "log.level", 3);
ndpi_set_config_u64(ndpi_struct, "all", "log", 1);
fd = buffer_to_file(data, size);
load_categories_file_fd(ndpi_struct, fd, NULL);
if(fd)
fclose(fd);
ndpi_exit_detection_module(ndpi_struct);
return 0;
}