diff options
author | Michele Campus <fci1908@gmail.com> | 2016-09-08 14:48:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-08 14:48:54 +0200 |
commit | 2ae4db34b03a4fb0fc919484b64f667530b609e9 (patch) | |
tree | eb85662717b6fe28f84edbdc3d61e6ac1c2008b0 /src/lib/protocols/mgcp.c | |
parent | 3ceb19a9c681dd5711d083fa9af894e643036fc3 (diff) | |
parent | 9ddaccbae0c35eec2cfc855d03ff04dcdbffe1ae (diff) |
Merge pull request #261 from tianzhishuizhu/dev
optimization for code duplication
Diffstat (limited to 'src/lib/protocols/mgcp.c')
-rw-r--r-- | src/lib/protocols/mgcp.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/protocols/mgcp.c b/src/lib/protocols/mgcp.c index f33ffd8ad..779caa0eb 100644 --- a/src/lib/protocols/mgcp.c +++ b/src/lib/protocols/mgcp.c @@ -51,15 +51,14 @@ __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; } /* 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; } @@ -78,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); |