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:
@@ -3023,3 +3023,11 @@ u_int32_t ndpi_nearest_power_of_two(u_int32_t x) {
|
||||
return(x);
|
||||
}
|
||||
|
||||
/* ******************************************* */
|
||||
|
||||
int tpkt_verify_hdr(const struct ndpi_packet_struct * const packet)
|
||||
{
|
||||
return ((packet->tcp != NULL) && (packet->payload_packet_len > 4) &&
|
||||
(packet->payload[0] == 3) && (packet->payload[1] == 0) &&
|
||||
(get_u_int16_t(packet->payload,2) == htons(packet->payload_packet_len)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user