Merge pull request #859 from catenacyber/fuzzudpfix
Checks enough data for UDP header
This commit is contained in:
@@ -1709,10 +1709,8 @@ ether_type_check:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(workflow->prefs.decode_tunnels && (proto == IPPROTO_UDP)) {
|
if(workflow->prefs.decode_tunnels && (proto == IPPROTO_UDP)) {
|
||||||
#if LUCA
|
|
||||||
if (header->caplen < ip_offset + ip_len + sizeof(struct ndpi_udphdr))
|
if (header->caplen < ip_offset + ip_len + sizeof(struct ndpi_udphdr))
|
||||||
return(nproto); /* Too short for UDP header*/
|
return(nproto); /* Too short for UDP header*/
|
||||||
#endif
|
|
||||||
struct ndpi_udphdr *udp = (struct ndpi_udphdr *)&packet[ip_offset+ip_len];
|
struct ndpi_udphdr *udp = (struct ndpi_udphdr *)&packet[ip_offset+ip_len];
|
||||||
u_int16_t sport = ntohs(udp->source), dport = ntohs(udp->dest);
|
u_int16_t sport = ntohs(udp->source), dport = ntohs(udp->dest);
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ static int search_valid_dns(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
/* Leave the statement below commented necessary in case of call to ndpi_get_partial_detection() */
|
/* Leave the statement below commented necessary in case of call to ndpi_get_partial_detection() */
|
||||||
x++;
|
x++;
|
||||||
|
|
||||||
if(flow->packet.payload[x] != '\0') {
|
if(x < flow->packet.payload_packet_len && flow->packet.payload[x] != '\0') {
|
||||||
while((x < flow->packet.payload_packet_len)
|
while((x < flow->packet.payload_packet_len)
|
||||||
&& (flow->packet.payload[x] != '\0')) {
|
&& (flow->packet.payload[x] != '\0')) {
|
||||||
x++;
|
x++;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void ndpi_search_fix(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
|||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
|
|
||||||
NDPI_LOG_DBG(ndpi_struct, "search FIX\n");
|
NDPI_LOG_DBG(ndpi_struct, "search FIX\n");
|
||||||
if(packet->tcp) {
|
if(packet->tcp && packet->payload_packet_len > 5) {
|
||||||
// 8=
|
// 8=
|
||||||
if(packet->payload[0] == 0x38 && packet->payload[1] == 0x3d) {
|
if(packet->payload[0] == 0x38 && packet->payload[1] == 0x3d) {
|
||||||
// FIX.
|
// FIX.
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ static void ndpi_int_ssh_add_connection(struct ndpi_detection_module_struct
|
|||||||
static u_int16_t concat_hash_string(struct ndpi_packet_struct *packet,
|
static u_int16_t concat_hash_string(struct ndpi_packet_struct *packet,
|
||||||
char *buf, u_int8_t client_hash) {
|
char *buf, u_int8_t client_hash) {
|
||||||
u_int16_t offset = 22, buf_out_len = 0;
|
u_int16_t offset = 22, buf_out_len = 0;
|
||||||
|
if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)
|
||||||
|
goto invalid_payload;
|
||||||
u_int32_t len = ntohl(*(u_int32_t*)&packet->payload[offset]);
|
u_int32_t len = ntohl(*(u_int32_t*)&packet->payload[offset]);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
|
|
||||||
|
|||||||
@@ -735,7 +735,9 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
u_int16_t base_offset = packet->tcp ? 38 : 46;
|
u_int16_t base_offset = packet->tcp ? 38 : 46;
|
||||||
u_int16_t version_offset = packet->tcp ? 4 : 12;
|
u_int16_t version_offset = packet->tcp ? 4 : 12;
|
||||||
u_int16_t offset = 38, extension_len, j;
|
u_int16_t offset = 38, extension_len, j;
|
||||||
u_int8_t session_id_len = packet->tcp ? packet->payload[offset] : packet->payload[46];
|
u_int8_t session_id_len = 0;
|
||||||
|
if (base_offset < total_len)
|
||||||
|
session_id_len = packet->payload[base_offset];
|
||||||
|
|
||||||
#ifdef DEBUG_TLS
|
#ifdef DEBUG_TLS
|
||||||
printf("SSL [len: %u][handshake_type: %02X]\n", packet->payload_packet_len, handshake_type);
|
printf("SSL [len: %u][handshake_type: %02X]\n", packet->payload_packet_len, handshake_type);
|
||||||
@@ -1134,10 +1136,10 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
version_str_len += rc;
|
version_str_len += rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(flow->protos.stun_ssl.ssl.tls_supported_versions == NULL)
|
if(flow->protos.stun_ssl.ssl.tls_supported_versions == NULL)
|
||||||
flow->protos.stun_ssl.ssl.tls_supported_versions = ndpi_strdup(version_str);
|
flow->protos.stun_ssl.ssl.tls_supported_versions = ndpi_strdup(version_str);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension_offset += extension_len;
|
extension_offset += extension_len;
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ u_int8_t check_ymsg(const u_int8_t * payload, u_int16_t payload_packet_len)
|
|||||||
if(ylen >= payload_packet_len || yahoo_len_parsed >= payload_packet_len)
|
if(ylen >= payload_packet_len || yahoo_len_parsed >= payload_packet_len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (payload_packet_len < yahoo_len_parsed + sizeof(struct ndpi_yahoo_header)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
yahoo = (struct ndpi_yahoo_header *) (payload + yahoo_len_parsed);
|
yahoo = (struct ndpi_yahoo_header *) (payload + yahoo_len_parsed);
|
||||||
}
|
}
|
||||||
while(memcmp(yahoo->YMSG_str, "YMSG", 4) == 0);
|
while(memcmp(yahoo->YMSG_str, "YMSG", 4) == 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user