Replace complicated TPKT header validation with an helper function (#2201)

* Replace complicated TPKT header validation with an helper function

* Move tpkt_verify_hdr function definition to ndpi_utils.c
This commit is contained in:
Vladimir Gavrilov
2023-12-10 12:10:50 +01:00
committed by GitHub
parent f74cf16c36
commit c809e7c069
6 changed files with 35 additions and 45 deletions
+1 -3
View File
@@ -47,9 +47,7 @@ static void ndpi_search_iso9506_1_mms(struct ndpi_detection_module_struct *ndpi_
NDPI_LOG_DBG(ndpi_struct, "search ISO 9506-1 MMS\n");
if ((packet->payload_packet_len > 60) && (packet->payload[0] == 3) &&
(packet->payload[1] == 0) &&
(get_u_int16_t(packet->payload, 2) == htons(packet->payload_packet_len)))
if ((packet->payload_packet_len > 60) && tpkt_verify_hdr(packet))
{
if (current_pkt_from_client_to_server(ndpi_struct, flow)) {
/* Check COTP and ISO 8327-1 headers */