fuzz: add fuzzers to test reader_util code (#2080)
This commit is contained in:
@@ -436,7 +436,7 @@ int parse_proto_name_list(char *str, NDPI_PROTOCOL_BITMASK *bitmask, int inverte
|
||||
}
|
||||
proto = ndpi_get_proto_id(module, n);
|
||||
if(proto == NDPI_PROTOCOL_UNKNOWN && strcmp(n,"unknown") && strcmp(n,"0")) {
|
||||
fprintf(stderr,"Invalid protocol %s\n",n);
|
||||
LOG(NDPI_LOG_ERROR, "Invalid protocol %s\n", n);
|
||||
ndpi_exit_detection_module(module);
|
||||
return 1;
|
||||
}
|
||||
@@ -475,7 +475,7 @@ struct ndpi_workflow* ndpi_workflow_init(const struct ndpi_workflow_prefs * pref
|
||||
workflow = ndpi_calloc(1, sizeof(struct ndpi_workflow));
|
||||
if(workflow == NULL) {
|
||||
LOG(NDPI_LOG_ERROR, "global structure initialization failed\n");
|
||||
ndpi_free(module);
|
||||
ndpi_exit_detection_module(module);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -489,8 +489,11 @@ struct ndpi_workflow* ndpi_workflow_init(const struct ndpi_workflow_prefs * pref
|
||||
|
||||
if(_debug_protocols != NULL && ! _debug_protocols_ok) {
|
||||
NDPI_BITMASK_RESET(debug_bitmask);
|
||||
if(parse_proto_name_list(_debug_protocols, &debug_bitmask, 0))
|
||||
exit(-1);
|
||||
if(parse_proto_name_list(_debug_protocols, &debug_bitmask, 0)) {
|
||||
ndpi_exit_detection_module(module);
|
||||
ndpi_free(workflow);
|
||||
return NULL;
|
||||
}
|
||||
_debug_protocols_ok = 1;
|
||||
}
|
||||
if(_debug_protocols_ok)
|
||||
|
||||
@@ -93,6 +93,10 @@ extern int dpdk_port_deinit(int port);
|
||||
#define SERIALIZATION_BUFSIZ (8192 * 2)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// inner hash table (ja3 -> security state)
|
||||
typedef struct ndpi_ja3_info {
|
||||
char * ja3;
|
||||
@@ -408,6 +412,7 @@ void ndpi_flow_info_free_data(struct ndpi_flow_info *flow);
|
||||
void ndpi_flow_info_freer(void *node);
|
||||
const char* print_cipher_id(u_int32_t cipher);
|
||||
double ndpi_flow_get_byte_count_entropy(const uint32_t byte_count[256], unsigned int num_bytes);
|
||||
int parse_proto_name_list(char *str, NDPI_PROTOCOL_BITMASK *bitmask, int inverted_logic);
|
||||
|
||||
extern int nDPI_LogLevel;
|
||||
|
||||
@@ -425,4 +430,8 @@ extern int nDPI_LogLevel;
|
||||
#define LINKTYPE_LINUX_SLL2 276
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user