Kerberos, TLS, example: fix some memory errors (#1419)
Detected by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43823 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43921 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43925
This commit is contained in:
@@ -2037,9 +2037,14 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
|||||||
if(iph->version == 6) {
|
if(iph->version == 6) {
|
||||||
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
|
iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset];
|
||||||
iph = NULL;
|
iph = NULL;
|
||||||
|
if(header->caplen < ip_offset + sizeof(struct ndpi_ipv6hdr))
|
||||||
|
return(nproto);
|
||||||
} else if(iph->version != IPVERSION) {
|
} else if(iph->version != IPVERSION) {
|
||||||
// printf("WARNING: not good (packet_id=%u)!\n", (unsigned int)workflow->stats.raw_packet_count);
|
// printf("WARNING: not good (packet_id=%u)!\n", (unsigned int)workflow->stats.raw_packet_count);
|
||||||
goto v4_warning;
|
goto v4_warning;
|
||||||
|
} else {
|
||||||
|
if(header->caplen < ip_offset + sizeof(struct ndpi_iphdr))
|
||||||
|
return(nproto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
name_offset++;
|
name_offset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(name_offset < packet->payload_packet_len - 1 &&
|
if(name_offset < packet->payload_packet_len - 3 &&
|
||||||
packet->payload[name_offset+1] == 0x1b)
|
packet->payload[name_offset+1] == 0x1b)
|
||||||
{
|
{
|
||||||
name_offset += 2;
|
name_offset += 2;
|
||||||
|
|||||||
@@ -2052,7 +2052,8 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
for(i=0; ja3.client.alpn[i] != '\0'; i++)
|
for(i=0; ja3.client.alpn[i] != '\0'; i++)
|
||||||
if(ja3.client.alpn[i] == ',') ja3.client.alpn[i] = '-';
|
if(ja3.client.alpn[i] == ',') ja3.client.alpn[i] = '-';
|
||||||
|
|
||||||
} else if(extension_id == 43 /* supported versions */) {
|
} else if(extension_id == 43 /* supported versions */ &&
|
||||||
|
offset+extension_offset < total_len) {
|
||||||
u_int16_t s_offset = offset+extension_offset;
|
u_int16_t s_offset = offset+extension_offset;
|
||||||
u_int8_t version_len = packet->payload[s_offset];
|
u_int8_t version_len = packet->payload[s_offset];
|
||||||
char version_str[256];
|
char version_str[256];
|
||||||
|
|||||||
Reference in New Issue
Block a user