aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
authorLuca <deri@ntop.org>2020-01-15 20:49:21 -0700
committerLuca <deri@ntop.org>2020-01-15 20:49:21 -0700
commit812505b56bb4508bc42e1615d6425ad26444d3f8 (patch)
tree1b1fba2d72ef180ec8ebacffe7f8c7d8517e4052 /example/reader_util.c
parent98d9f524f9ff7746d0345939fe543020f8057212 (diff)
Added sanity check
Diffstat (limited to 'example/reader_util.c')
-rw-r--r--example/reader_util.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/example/reader_util.c b/example/reader_util.c
index 1376f9b8d..8a6a0d637 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -1424,6 +1424,9 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
datalink_type = (int)pcap_datalink(workflow->pcap_handle);
#endif
+ if(header->caplen < 40)
+ return(nproto); /* Too short */
+
datalink_check:
switch(datalink_type) {
case DLT_NULL:
@@ -1587,7 +1590,8 @@ ether_type_check:
if(cap_warning_used == 0) {
if(!workflow->prefs.quiet_mode)
- NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_DEBUG, "\n\nWARNING: packet capture size is smaller than packet size, DETECTION MIGHT NOT WORK CORRECTLY\n\n");
+ NDPI_LOG(0, workflow->ndpi_struct, NDPI_LOG_DEBUG,
+ "\n\nWARNING: packet capture size is smaller than packet size, DETECTION MIGHT NOT WORK CORRECTLY\n\n");
cap_warning_used = 1;
}
}