fuzz: fuzz_config: we need bigegr inputs (#2285)
This commit is contained in:
@@ -34,11 +34,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
char cfg_param[32];
|
||||
u_int64_t cat_userdata = 0;
|
||||
|
||||
|
||||
/* Just to be sure to have some data */
|
||||
if(fuzzed_data.remaining_bytes() < NDPI_MAX_SUPPORTED_PROTOCOLS * 2 + 200)
|
||||
return -1;
|
||||
|
||||
/* To allow memory allocation failures */
|
||||
fuzz_set_alloc_callbacks_and_seed(size);
|
||||
|
||||
@@ -85,6 +80,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
ndpi_load_malicious_sha1_file(ndpi_info_mod, fuzzed_data.ConsumeBool() ? NULL : "invalid_filename"); /* Error */
|
||||
if(fuzzed_data.ConsumeBool())
|
||||
ndpi_load_domain_suffixes(ndpi_info_mod, (char *)"public_suffix_list.dat");
|
||||
if(fuzzed_data.ConsumeBool())
|
||||
ndpi_load_domain_suffixes(ndpi_info_mod, (char *)"public_suffix_list.dat"); /* To trigger reload */
|
||||
if(fuzzed_data.ConsumeBool())
|
||||
ndpi_load_domain_suffixes(ndpi_info_mod, fuzzed_data.ConsumeBool() ? NULL : (char *)"invalid_filename"); /* Error */
|
||||
/* Note that this function is not used by ndpiReader */
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
[libfuzzer]
|
||||
close_fd_mask=1
|
||||
max_len=8192
|
||||
len_control=0
|
||||
|
||||
@@ -29,7 +29,6 @@ int ndpi_load_domain_suffixes(struct ndpi_detection_module_struct *ndpi_str,
|
||||
char *public_suffix_list_path) {
|
||||
char buf[256], *line;
|
||||
FILE *fd;
|
||||
bool do_trace = false;
|
||||
u_int num_domains = 0;
|
||||
|
||||
if(public_suffix_list_path == NULL)
|
||||
@@ -64,16 +63,16 @@ int ndpi_load_domain_suffixes(struct ndpi_detection_module_struct *ndpi_str,
|
||||
|
||||
if(!ndpi_domain_classify_add(ndpi_str->public_domain_suffixes,
|
||||
1 /* dummy */, &line[offset])) {
|
||||
if(do_trace) NDPI_LOG_ERR(ndpi_str, "Error while processing domain %s\n", &line[offset]);
|
||||
NDPI_LOG_ERR(ndpi_str, "Error while processing domain %s\n", &line[offset]);
|
||||
} else
|
||||
num_domains++;
|
||||
}
|
||||
|
||||
if(!ndpi_domain_classify_finalize(ndpi_str->public_domain_suffixes)) {
|
||||
if(do_trace) NDPI_LOG_ERR(ndpi_str, "Error while finalizing domain processing\n");
|
||||
NDPI_LOG_ERR(ndpi_str, "Error while finalizing domain processing\n");
|
||||
}
|
||||
|
||||
if(do_trace) NDPI_LOG_ERR(ndpi_str, "Loaded %u domains\n", num_domains);
|
||||
NDPI_LOG_DBG(ndpi_str, "Loaded %u domains\n", num_domains);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user