Enhanced string boundary check to avoid crashes with malformed packets

This commit is contained in:
Luca Deri
2016-06-15 06:12:41 +02:00
parent d113f8db5a
commit 19324f2904
2 changed files with 139 additions and 55 deletions
+1 -1
View File
@@ -324,7 +324,7 @@ void ndpi_search_netbios(struct ndpi_detection_module_struct *ndpi_struct, struc
NDPI_LOG_DEBUG, "found netbios with checked ip-address.\n");
if(netbios_name_interpret((char*)&packet->payload[12], name, sizeof(name)) > 0)
snprintf((char*)flow->host_server_name, sizeof(flow->host_server_name), "%s", name);
snprintf((char*)flow->host_server_name, sizeof(flow->host_server_name)-1, "%s", name);
ndpi_int_netbios_add_connection(ndpi_struct, flow);
return;