From 9af2b9d815632fc4d28fcd4306f5599e15b237ef Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Sat, 3 Feb 2024 04:11:58 +0100 Subject: collectd: fix extraction of hostname (#2301) --- src/lib/protocols/collectd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/protocols/collectd.c b/src/lib/protocols/collectd.c index 500b9a3f3..d4586d90a 100644 --- a/src/lib/protocols/collectd.c +++ b/src/lib/protocols/collectd.c @@ -159,7 +159,8 @@ static void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struc * the collectd protocol. */ hostname_offset = block_offset; - hostname_length = block_length; + if(block_length > 4) + hostname_length = block_length - 4; /* Ignore type and length fields */ } else if (block_type == COLELCTD_TYPE_ENCR_AES256) { /* * The encrypted data block is a special case. -- cgit v1.2.3