From ac8aaf0e08846d652e16abd46465d5c0f864de9a Mon Sep 17 00:00:00 2001 From: tianzhishuizhu Date: Thu, 8 Sep 2016 16:29:39 +0800 Subject: optimization for code duplicationdup --- src/lib/protocols/mgcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/protocols/mgcp.c b/src/lib/protocols/mgcp.c index f33ffd8ad..feffe85c0 100644 --- a/src/lib/protocols/mgcp.c +++ b/src/lib/protocols/mgcp.c @@ -58,8 +58,7 @@ __forceinline static } /* packet must end with 0x0d0a or with 0x0a */ - if (packet->payload[packet->payload_packet_len - 1] != 0x0a - && get_u_int16_t(packet->payload, packet->payload_packet_len - 2) != htons(0x0d0a)) { + if (packet->payload[packet->payload_packet_len - 1] != 0x0a) { goto mgcp_excluded; } -- cgit v1.2.3 From ce3493952b5c91e38cf70368d466fd006055def9 Mon Sep 17 00:00:00 2001 From: tianzhishuizhu Date: Thu, 8 Sep 2016 17:02:50 +0800 Subject: logical error --- src/lib/protocols/mgcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/protocols/mgcp.c b/src/lib/protocols/mgcp.c index feffe85c0..779caa0eb 100644 --- a/src/lib/protocols/mgcp.c +++ b/src/lib/protocols/mgcp.c @@ -51,7 +51,7 @@ __forceinline static /* information about MGCP taken from http://en.wikipedia.org/wiki/MGCP */ - u_int16_t pos = 4; + u_int16_t pos = 5; if (packet->payload_packet_len < 8) { goto mgcp_excluded; @@ -77,7 +77,7 @@ __forceinline static goto mgcp_excluded; } // now search for string "MGCP " in the rest of the message - while ((pos + 5) < packet->payload_packet_len) { + while ((pos + 4) < packet->payload_packet_len) { if (memcmp(&packet->payload[pos], "MGCP ", 5) == 0) { NDPI_LOG(NDPI_PROTOCOL_MGCP, ndpi_struct, NDPI_LOG_DEBUG, "MGCP match.\n"); ndpi_int_mgcp_add_connection(ndpi_struct, flow); -- cgit v1.2.3 From f7ca670ce02562abc960d5ab4aa3772de96be36d Mon Sep 17 00:00:00 2001 From: tianzhishuizhu Date: Thu, 8 Sep 2016 19:49:13 +0800 Subject: delete variables unused --- src/lib/protocols/mpegts.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/lib/protocols/mpegts.c b/src/lib/protocols/mpegts.c index 4453c6839..4970147e1 100644 --- a/src/lib/protocols/mpegts.c +++ b/src/lib/protocols/mpegts.c @@ -27,7 +27,6 @@ void ndpi_search_mpegts(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct *packet = &flow->packet; - u_int16_t dport = 0, sport = 0; NDPI_LOG(NDPI_PROTOCOL_MPEGTS, ndpi_struct, NDPI_LOG_DEBUG, "search for MPEGTS.\n"); -- cgit v1.2.3 From 9ddaccbae0c35eec2cfc855d03ff04dcdbffe1ae Mon Sep 17 00:00:00 2001 From: tianzhishuizhu Date: Thu, 8 Sep 2016 19:53:03 +0800 Subject: text error --- src/lib/protocols/afp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/protocols/afp.c b/src/lib/protocols/afp.c index 0f61986bc..74b98b8d0 100644 --- a/src/lib/protocols/afp.c +++ b/src/lib/protocols/afp.c @@ -54,7 +54,7 @@ void ndpi_search_afp(struct ndpi_detection_module_struct *ndpi_struct, struct nd } /* - * detection of GetStatus command of DSI protocl + * detection of GetStatus command of DSI protocol */ if (packet->payload_packet_len >= 18 && get_u_int16_t(packet->payload, 0) == htons(0x0003) && get_u_int16_t(packet->payload, 2) == htons(0x0001) && get_u_int32_t(packet->payload, 4) == 0 && -- cgit v1.2.3