diff options
Diffstat (limited to 'src/lib/protocols/tcp_udp.c')
-rw-r--r-- | src/lib/protocols/tcp_udp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/protocols/tcp_udp.c b/src/lib/protocols/tcp_udp.c index 9aa0349f0..ec49e63ba 100644 --- a/src/lib/protocols/tcp_udp.c +++ b/src/lib/protocols/tcp_udp.c @@ -53,11 +53,13 @@ void ndpi_search_tcp_or_udp(struct ndpi_detection_module_struct *ndpi_struct, st { u_int16_t sport, dport; u_int proto; - struct ndpi_packet_struct *packet = &ndpi_struct->packet; + struct ndpi_packet_struct *packet; - if(flow->host_server_name[0] != '\0') + if(!ndpi_struct || !flow || flow->host_server_name[0] != '\0') return; + packet = &ndpi_struct->packet; + if(packet->udp) sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest); else if(packet->tcp) sport = ntohs(packet->tcp->source), dport = ntohs(packet->tcp->dest); else sport = dport = 0; |