From f352e4f77b4f9523a8722b9a1702377cc0375c16 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Fri, 9 Feb 2024 09:20:02 +0100 Subject: Improve normalization of `flow->host_server_name` (#2310) Follow-up of 4543385d107fcc5a7e8632e35d9a60bcc40cb4f4 Remove trailing spaces for any HTTP header (we already remove leading spaces) We want: * a "normalized" string in `flow->host_server_name`, but * to parse the original string for flow risk checking `ndpi_hostname_sni_set()` is a private function, so there is no need to export its flags. --- src/lib/protocols/fastcgi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/protocols/fastcgi.c') diff --git a/src/lib/protocols/fastcgi.c b/src/lib/protocols/fastcgi.c index 6ccd96d43..6a1baa758 100644 --- a/src/lib/protocols/fastcgi.c +++ b/src/lib/protocols/fastcgi.c @@ -213,8 +213,8 @@ static void ndpi_search_fastcgi(struct ndpi_detection_module_struct *ndpi_struct &ret_match, NDPI_PROTOCOL_FASTCGI); ndpi_check_dga_name(ndpi_struct, flow, flow->host_server_name, 1, 0); - if(ndpi_is_valid_hostname(flow->host_server_name, - strlen(flow->host_server_name)) == 0) { + if(ndpi_is_valid_hostname((char *)packet->host_line.ptr, + packet->host_line.len) == 0) { char str[128]; snprintf(str, sizeof(str), "Invalid host %s", flow->host_server_name); -- cgit v1.2.3