aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/rdp.c
diff options
context:
space:
mode:
authorVladimir Gavrilov <105977161+0xA50C1A1@users.noreply.github.com>2023-12-10 14:10:50 +0300
committerGitHub <noreply@github.com>2023-12-10 12:10:50 +0100
commitc809e7c0691a77e84036df78067e482700263c71 (patch)
tree4644bae2ec2a940491bddae04f2e279068766ccb /src/lib/protocols/rdp.c
parentf74cf16c361018fc98d796978013df4ca0c6050f (diff)
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
Diffstat (limited to 'src/lib/protocols/rdp.c')
-rw-r--r--src/lib/protocols/rdp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lib/protocols/rdp.c b/src/lib/protocols/rdp.c
index e95c6e853..f641f7690 100644
--- a/src/lib/protocols/rdp.c
+++ b/src/lib/protocols/rdp.c
@@ -41,15 +41,13 @@ static void ndpi_int_rdp_add_connection(struct ndpi_detection_module_struct *ndp
static void ndpi_search_rdp(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow) {
- struct ndpi_packet_struct *packet = &ndpi_struct->packet;
+ const struct ndpi_packet_struct * const packet = &ndpi_struct->packet;
NDPI_LOG_DBG(ndpi_struct, "search RDP\n");
if (packet->tcp != NULL) {
if(packet->payload_packet_len > 13 &&
- /* TPKT */
- packet->payload[0] == 0x03 && packet->payload[1] == 0x00 &&
- ntohs(*(uint16_t *)&packet->payload[2]) == packet->payload_packet_len &&
+ tpkt_verify_hdr(packet) &&
/* COTP */
packet->payload[4] == packet->payload_packet_len - 5) {