telnet: fix heap-overflow error
There is some boilerplate since I removed an if branch and I had to reindent the code
This commit is contained in:
@@ -36,19 +36,17 @@
|
||||
static int search_telnet_again(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
int i;
|
||||
|
||||
#ifdef TELNET_DEBUG
|
||||
printf("==> %s() [%s][direction: %u]\n", __FUNCTION__, packet->payload, packet->packet_direction);
|
||||
#endif
|
||||
|
||||
if (packet->payload == NULL)
|
||||
if (packet->payload == NULL || packet->payload_packet_len == 0)
|
||||
return(1);
|
||||
if(packet->payload[0] == 0xFF)
|
||||
return(1);
|
||||
|
||||
if(packet->payload_packet_len > 0) {
|
||||
int i;
|
||||
|
||||
if(flow->protos.telnet.username_detected) {
|
||||
if((!flow->protos.telnet.password_found)
|
||||
&& (packet->payload_packet_len > 6)) {
|
||||
@@ -102,7 +100,6 @@ static int search_telnet_again(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
flow->protos.telnet.username[flow->protos.telnet.character_id++] = packet->payload[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Possibly more processing */
|
||||
return(1);
|
||||
|
||||
Reference in New Issue
Block a user