From 550f3e5b9d9de4e662ecfbed0059cd3351e2278b Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Tue, 25 Oct 2022 16:16:24 +0200 Subject: IRC: fix memory access (#1787) --- src/lib/protocols/irc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/protocols/irc.c b/src/lib/protocols/irc.c index 9f9034641..a5da28ef1 100644 --- a/src/lib/protocols/irc.c +++ b/src/lib/protocols/irc.c @@ -408,7 +408,7 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc if(user) { char buf[32], msg[64], *sp; - snprintf(buf, sizeof(buf), "%.*s", packet->payload_packet_len - 5, &user[5]); + snprintf(buf, sizeof(buf), "%.*s", (int)(packet->payload_packet_len - (user + 5 - (char *)packet->payload)), user + 5); if((sp = strchr(buf, ' ')) != NULL) sp[0] = '\0'; -- cgit v1.2.3