Minor UA handling improvement to avoid heap-overflow

This commit is contained in:
Luca Deri
2020-09-22 08:56:35 +02:00
parent 27bad14738
commit 5f99433ee7
2 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -347,7 +347,7 @@ int http_process_user_agent(struct ndpi_detection_module_struct *ndpi_struct,
flow->http.user_agent = ndpi_malloc(len);
if(flow->http.user_agent) {
strncpy(flow->http.user_agent, (char*)ua_ptr, ua_ptr_len);
memcpy(flow->http.user_agent, (char*)ua_ptr, ua_ptr_len);
flow->http.user_agent[ua_ptr_len] = '\0';
ndpi_check_user_agent(ndpi_struct, flow, flow->http.user_agent);