@@ -2735,7 +2735,7 @@ static ndpi_patricia_node_t* add_to_ptree(ndpi_patricia_tree_t *tree, int family
2735
2735
/* ******************************************* */
2736
2736
2737
2737
/*
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'
2739
2739
2740
2740
Return: the number of entries loaded or -1 in case of error
2741
2741
*/
@@ -2808,13 +2808,17 @@ int ndpi_load_ptree_file(ndpi_patricia_tree_t *ptree,
2808
2808
2809
2809
int ndpi_load_ipv4_ptree_file (ndpi_ptree_t * ptree , const char * path ,
2810
2810
u_int16_t protocol_id ) {
2811
+ if (!ptree )
2812
+ return -1 ;
2811
2813
return (ndpi_load_ptree_file (ptree -> v4 , path , true /* IPv4 */ , protocol_id ));
2812
2814
}
2813
2815
2814
2816
/* ******************************************* */
2815
2817
2816
2818
int ndpi_load_ipv6_ptree_file (ndpi_ptree_t * ptree , const char * path ,
2817
2819
u_int16_t protocol_id ) {
2820
+ if (!ptree )
2821
+ return -1 ;
2818
2822
return (ndpi_load_ptree_file (ptree -> v6 , path , false /* IPv6 */ , protocol_id ));
2819
2823
}
2820
2824
@@ -2827,6 +2831,8 @@ int ndpi_load_ipv6_ptree_file(ndpi_ptree_t *ptree, const char *path,
2827
2831
*/
2828
2832
int ndpi_load_ipv4_ptree (struct ndpi_detection_module_struct * ndpi_str ,
2829
2833
const char * path , u_int16_t protocol_id ) {
2834
+ if (!ndpi_str )
2835
+ return -1 ;
2830
2836
return (ndpi_load_ptree_file (ndpi_str -> protocols_ptree ,
2831
2837
path , true /* is_ipv4 */ ,
2832
2838
protocol_id ));
0 commit comments