fixed numeric truncation error

This commit is contained in:
headshog
2023-05-20 15:09:51 +02:00
committed by Ivan Nardi
parent 5ca6f0ac62
commit dd7198fcaf
3 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -1505,7 +1505,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
if(flow->iat_flow if(flow->iat_flow
&& (tdiff.tv_sec >= 0) /* Discard backward time */ && (tdiff.tv_sec >= 0) /* Discard backward time */
) { ) {
u_int32_t ms = ndpi_timeval_to_milliseconds(tdiff); u_int64_t ms = ndpi_timeval_to_milliseconds(tdiff);
if(ms > 0) if(ms > 0)
ndpi_data_add_value(flow->iat_flow, ms); ndpi_data_add_value(flow->iat_flow, ms);
@@ -1521,7 +1521,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
if(flow->iat_c_to_s if(flow->iat_c_to_s
&& (tdiff.tv_sec >= 0) /* Discard backward time */ && (tdiff.tv_sec >= 0) /* Discard backward time */
) { ) {
u_int32_t ms = ndpi_timeval_to_milliseconds(tdiff); u_int64_t ms = ndpi_timeval_to_milliseconds(tdiff);
ndpi_data_add_value(flow->iat_c_to_s, ms); ndpi_data_add_value(flow->iat_c_to_s, ms);
} }
@@ -1540,7 +1540,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
ndpi_timer_sub(&when, &flow->dst2src_last_pkt_time, &tdiff); ndpi_timer_sub(&when, &flow->dst2src_last_pkt_time, &tdiff);
if(flow->iat_s_to_c) { if(flow->iat_s_to_c) {
u_int32_t ms = ndpi_timeval_to_milliseconds(tdiff); u_int64_t ms = ndpi_timeval_to_milliseconds(tdiff);
ndpi_data_add_value(flow->iat_s_to_c, ms); ndpi_data_add_value(flow->iat_s_to_c, ms);
} }
+1 -1
View File
@@ -1698,7 +1698,7 @@ extern "C" {
void ndpi_init_data_analysis(struct ndpi_analyze_struct *s, u_int16_t _max_series_len); void ndpi_init_data_analysis(struct ndpi_analyze_struct *s, u_int16_t _max_series_len);
void ndpi_free_data_analysis(struct ndpi_analyze_struct *d, u_int8_t free_pointer); void ndpi_free_data_analysis(struct ndpi_analyze_struct *d, u_int8_t free_pointer);
void ndpi_reset_data_analysis(struct ndpi_analyze_struct *d); void ndpi_reset_data_analysis(struct ndpi_analyze_struct *d);
void ndpi_data_add_value(struct ndpi_analyze_struct *s, const u_int32_t value); void ndpi_data_add_value(struct ndpi_analyze_struct *s, const u_int64_t value);
/* Sliding-window only */ /* Sliding-window only */
float ndpi_data_window_average(struct ndpi_analyze_struct *s); float ndpi_data_window_average(struct ndpi_analyze_struct *s);
+1 -1
View File
@@ -93,7 +93,7 @@ void ndpi_reset_data_analysis(struct ndpi_analyze_struct *d) {
/* /*
Add a new point to analyze Add a new point to analyze
*/ */
void ndpi_data_add_value(struct ndpi_analyze_struct *s, const u_int32_t value) { void ndpi_data_add_value(struct ndpi_analyze_struct *s, const u_int64_t value) {
if(!s) if(!s)
return; return;