@@ -44,14 +44,15 @@ void ndpi_search_drda(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
|
|
||||||
/* check port */
|
/* check port */
|
||||||
if((ntohs(packet->tcp->source) == DRDA_PORT ||
|
if((ntohs(packet->tcp->source) == DRDA_PORT ||
|
||||||
ntohs(packet->tcp->dest) == DRDA_PORT)) {
|
ntohs(packet->tcp->dest) == DRDA_PORT) &&
|
||||||
|
payload_len >= sizeof(struct ndpi_drda_hdr)) {
|
||||||
|
|
||||||
struct ndpi_drda_hdr * drda = (struct ndpi_drda_hdr *) packet->payload;
|
struct ndpi_drda_hdr * drda = (struct ndpi_drda_hdr *) packet->payload;
|
||||||
|
|
||||||
u_int16_t len = ntohs(drda->length);
|
u_int16_t len = ntohs(drda->length);
|
||||||
|
|
||||||
/* check first header */
|
/* check first header */
|
||||||
if(len - 6 != ntohs(drda->length2) &&
|
if(len != ntohs(drda->length2) + 6 &&
|
||||||
drda->magic != 0xd0)
|
drda->magic != 0xd0)
|
||||||
goto no_drda;
|
goto no_drda;
|
||||||
|
|
||||||
@@ -59,15 +60,14 @@ void ndpi_search_drda(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
if(payload_len > len) {
|
if(payload_len > len) {
|
||||||
|
|
||||||
count = len;
|
count = len;
|
||||||
const u_int8_t * pp = packet->payload + len;
|
|
||||||
|
|
||||||
while(count < payload_len)
|
while(count + sizeof(struct ndpi_drda_hdr) < payload_len)
|
||||||
{
|
{
|
||||||
/* update info */
|
/* update info */
|
||||||
drda = (struct ndpi_drda_hdr *) pp;
|
drda = (struct ndpi_drda_hdr *)(packet->payload + count);
|
||||||
len = ntohs(drda->length);
|
len = ntohs(drda->length);
|
||||||
|
|
||||||
if(len - 6 != ntohs(drda->length2) &&
|
if(len != ntohs(drda->length2) + 6 &&
|
||||||
drda->magic != 0xd0)
|
drda->magic != 0xd0)
|
||||||
goto no_drda;
|
goto no_drda;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user