IRC: fix memory access (#1787)

This commit is contained in:
Ivan Nardi 2022-10-25 16:16:24 +02:00 committed by GitHub
parent e674a8ae37
commit 550f3e5b9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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';