Protobuf: fix false positives (#2428)

This commit is contained in:
Ivan Nardi
2024-05-09 15:38:06 +02:00
committed by GitHub
parent 18e03a26ca
commit 2e7fc82e55
4 changed files with 41 additions and 13 deletions
+4 -2
View File
@@ -201,7 +201,7 @@ static void ndpi_search_protobuf(struct ndpi_detection_module_struct *ndpi_struc
if (packet->payload_packet_len < offset + sizeof(uint32_t))
{
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
break;
return;
}
#ifdef DEBUG_PROTOBUF
union {
@@ -226,7 +226,9 @@ static void ndpi_search_protobuf(struct ndpi_detection_module_struct *ndpi_struc
(unsigned long long int)protobuf_elements,
(unsigned long long int)protobuf_len_elements);
#endif
if ((protobuf_elements >= PROTOBUF_REQUIRED_ELEMENTS && protobuf_len_elements > 0)
if ((protobuf_elements >= PROTOBUF_REQUIRED_ELEMENTS && protobuf_len_elements > 0 &&
/* (On UDP) this packet might be also a RTP/RTCP one. Wait for the next one */
(flow->packet_counter > 1 || flow->l4_proto == IPPROTO_TCP || flow->l4.udp.rtp_stage == 0))
|| (flow->packet_counter >= PROTOBUF_MIN_PACKETS && protobuf_elements >= PROTOBUF_MIN_ELEMENTS))
{
#ifdef DEBUG_PROTOBUF