Added check on payload lenght during extra packet processing

This commit is contained in:
Luca Deri
2020-08-04 21:59:45 +02:00
parent e16675b700
commit 00b2763399
2 changed files with 9 additions and 7 deletions
+3 -1
View File
@@ -71,6 +71,7 @@ static void ndpi_analyze_content_signature(struct ndpi_flow_struct *flow) {
static int ndpi_search_http_tcp_again(struct ndpi_detection_module_struct *ndpi_struct, static int ndpi_search_http_tcp_again(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow) { struct ndpi_flow_struct *flow) {
ndpi_search_http_tcp(ndpi_struct, flow); ndpi_search_http_tcp(ndpi_struct, flow);
#ifdef HTTP_DEBUG #ifdef HTTP_DEBUG
@@ -741,7 +742,8 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
packet->packet_lines_parsed_complete = 0; packet->packet_lines_parsed_complete = 0;
/* Check if we so far detected the protocol in the request or not. */ /* Check if we so far detected the protocol in the request or not. */
if(flow->l4.tcp.http_stage == 0) { if((packet->payload_packet_len > 0) /* Needed in case of extra packet processing */
&& (flow->l4.tcp.http_stage == 0)) {
/* Expected a request */ /* Expected a request */
flow->http_detected = 0; flow->http_detected = 0;
+3 -3
View File
@@ -42,9 +42,9 @@ static int search_telnet_again(struct ndpi_detection_module_struct *ndpi_struct,
printf("==> %s() [%s][direction: %u]\n", __FUNCTION__, packet->payload, packet->packet_direction); printf("==> %s() [%s][direction: %u]\n", __FUNCTION__, packet->payload, packet->packet_direction);
#endif #endif
if (packet->payload == NULL || packet->payload_packet_len == 0) if((packet->payload == NULL)
return(1); || (packet->payload_packet_len == 0)
if(packet->payload[0] == 0xFF) || (packet->payload[0] == 0xFF))
return(1); return(1);
if(flow->protos.telnet.username_detected) { if(flow->protos.telnet.username_detected) {