Fix some invalid memory reads (#1350)

`ndpi_detection_giveup()` (and any functions called by it) can't access
`ndpi_detection_module_struct->packet` anymore since 730c236.

Sync unit tests results

Close #1348
This commit is contained in:
Ivan Nardi
2021-10-19 12:07:47 +02:00
committed by GitHub
parent 06f13fd2de
commit fea3991ad1
5 changed files with 82 additions and 80 deletions
+8 -4
View File
@@ -1198,7 +1198,7 @@ struct ndpi_flow_struct {
/* init parameter, internal used to set up timestamp,... */
u_int16_t guessed_protocol_id, guessed_host_protocol_id, guessed_category, guessed_header_category;
u_int8_t l4_proto, protocol_id_already_guessed:1, host_already_guessed:1, fail_with_unknown:1,
init_finished:1, setup_packet_direction:1, packet_direction:1, check_extra_packets:1;
init_finished:1, setup_packet_direction:1, packet_direction:1, check_extra_packets:1, is_ipv6:1;
/*
if ndpi_struct->direction_detect_disable == 1
@@ -1206,6 +1206,11 @@ struct ndpi_flow_struct {
*/
u_int32_t next_tcp_seq_nr[2];
/* Flow addresses (used mainly for LRU lookups in ndpi_detection_giveup())
* TODO: ipv6. Note that LRU is ipv4 only, for the time being */
u_int32_t saddr;
u_int32_t daddr;
// -----------------------------------------
u_int8_t max_extra_packets_to_check;
@@ -1214,6 +1219,8 @@ struct ndpi_flow_struct {
int (*extra_packets_func) (struct ndpi_detection_module_struct *, struct ndpi_flow_struct *flow);
u_int64_t last_packet_time_ms;
/*
the tcp / udp / other l4 value union
used to reduce the number of bytes for tcp or udp protocol states
@@ -1415,9 +1422,6 @@ struct ndpi_flow_struct {
u_int8_t ovpn_session_id[8];
u_int8_t ovpn_counter;
/* Flow key used to search a match into the mining cache */
u_int32_t key_mining_cache;
/* NDPI_PROTOCOL_TINC */
u_int8_t tinc_state;
struct tinc_cache_entry tinc_cache_entry;