fixed server-side pm buffer overflow

This commit is contained in:
Václav Šmejkal 2024-08-30 14:31:14 +02:00
parent 17f1329325
commit 972619bafa
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -739,7 +739,7 @@ void *why2_communicate_thread(void *arg)
connection_node_t pm_connection_node = *(connection_node_t*) pm_connection -> value;
//ALLOCATE MESSAGE TO SEND TO RECEIVER
char *private_msg = why2_malloc(strlen(WHY2_CHAT_CODE_PM_SERVER) + strlen(node.username) + strlen(pm_connection_node.username) + strlen(msg) + 5);
char *private_msg = why2_malloc(strlen(WHY2_CHAT_CODE_PM_SERVER) + strlen(node.username) + strlen(pm_connection_node.username) + strlen(msg) + 6);
//CONSTRUCT DA MESSAGE
sprintf(private_msg, WHY2_CHAT_CODE_PM_SERVER ";%s;%s;%s;%c", node.username, pm_connection_node.username, msg, '\0');