Fixed more buffer overflows with small packets

This commit is contained in:
theirix
2016-04-12 22:14:13 +03:00
parent fb3fc0c6de
commit c22d3d3cae
8 changed files with 60 additions and 57 deletions
+1 -1
View File
@@ -294,7 +294,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
return;
}
if (memcmp(packet->payload, "GND", 3) == 0) {
if (packet->payload_packet_len >= 3 && memcmp(packet->payload, "GND", 3) == 0) {
if ((packet->payload_packet_len == 8 && (memcmp(&packet->payload[6], "\x01\x00", 2) == 0))
|| (packet->payload_packet_len == 11 && (memcmp(&packet->payload[6], "\x01\x01\x08\x50\x49", 5)
== 0)) || (packet->payload_packet_len == 17