aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichele Campus <fci1908@gmail.com>2016-08-22 14:54:56 +0200
committerGitHub <noreply@github.com>2016-08-22 14:54:56 +0200
commitb6802767aabd4b28f8e0d7cc2bcb1a69d724abfc (patch)
tree9f2d1f9d93c01e71e55ea540ba74b00158ecb5d3 /src
parentb34d418b57f0c211f441b8d03229766ce3ea13e9 (diff)
parent76f74540497535373ac3fe6069faef4011cee025 (diff)
Merge pull request #253 from theirix/fix-drda2
Fix drda in addition to #242
Diffstat (limited to 'src')
-rw-r--r--src/lib/protocols/drda.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/protocols/drda.c b/src/lib/protocols/drda.c
index 9369665db..fe75379ff 100644
--- a/src/lib/protocols/drda.c
+++ b/src/lib/protocols/drda.c
@@ -38,7 +38,7 @@ void ndpi_search_drda(struct ndpi_detection_module_struct *ndpi_struct,
{
struct ndpi_packet_struct * packet = &flow->packet;
u_int16_t payload_len = packet->payload_packet_len;
- u_int16_t count = 0;
+ u_int count = 0; // prevent integer overflow
if(packet->tcp != NULL) {
@@ -52,7 +52,7 @@ void ndpi_search_drda(struct ndpi_detection_module_struct *ndpi_struct,
u_int16_t len = ntohs(drda->length);
/* check first header */
- if(len != ntohs(drda->length2) + 6 &&
+ if(len != ntohs(drda->length2) + 6 ||
drda->magic != 0xd0)
goto no_drda;
@@ -67,7 +67,7 @@ void ndpi_search_drda(struct ndpi_detection_module_struct *ndpi_struct,
drda = (struct ndpi_drda_hdr *)(packet->payload + count);
len = ntohs(drda->length);
- if(len != ntohs(drda->length2) + 6 &&
+ if(len != ntohs(drda->length2) + 6 ||
drda->magic != 0xd0)
goto no_drda;