@@ -2735,7 +2735,7 @@ static ndpi_patricia_node_t* add_to_ptree(ndpi_patricia_tree_t *tree, int family
27352735/* ******************************************* */
27362736
27372737/*
2738- Load a file containing IPv4 addresses in CIDR format as 'protocol_id'
2738+ Load a file containing IPv4 OR IPv6 addresses in CIDR format as 'protocol_id'
27392739
27402740 Return: the number of entries loaded or -1 in case of error
27412741*/
@@ -2808,13 +2808,17 @@ int ndpi_load_ptree_file(ndpi_patricia_tree_t *ptree,
28082808
28092809int ndpi_load_ipv4_ptree_file (ndpi_ptree_t * ptree , const char * path ,
28102810 u_int16_t protocol_id ) {
2811+ if (!ptree )
2812+ return -1 ;
28112813 return (ndpi_load_ptree_file (ptree -> v4 , path , true /* IPv4 */ , protocol_id ));
28122814}
28132815
28142816/* ******************************************* */
28152817
28162818int ndpi_load_ipv6_ptree_file (ndpi_ptree_t * ptree , const char * path ,
28172819 u_int16_t protocol_id ) {
2820+ if (!ptree )
2821+ return -1 ;
28182822 return (ndpi_load_ptree_file (ptree -> v6 , path , false /* IPv6 */ , protocol_id ));
28192823}
28202824
@@ -2827,6 +2831,8 @@ int ndpi_load_ipv6_ptree_file(ndpi_ptree_t *ptree, const char *path,
28272831*/
28282832int ndpi_load_ipv4_ptree (struct ndpi_detection_module_struct * ndpi_str ,
28292833 const char * path , u_int16_t protocol_id ) {
2834+ if (!ndpi_str )
2835+ return -1 ;
28302836 return (ndpi_load_ptree_file (ndpi_str -> protocols_ptree ,
28312837 path , true /* is_ipv4 */ ,
28322838 protocol_id ));
0 commit comments