From 68a484cae1de615a6804886c0472129be4de1abc Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Thu, 20 Apr 2023 21:42:53 +0200 Subject: [PATCH] fixed why2_send_socket's text_copy allocation size --- src/chat/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chat/misc.c b/src/chat/misc.c index 0735c71..69899ac 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -241,7 +241,7 @@ void why2_send_socket(char *text, char *username, int socket) { char *output = why2_strdup(""); size_t length_buffer = strlen(text); - char *text_copy = why2_calloc(length_buffer, sizeof(char)); + char *text_copy = why2_calloc(length_buffer + 2, sizeof(char)); struct json_object *json = json_tokener_parse("{}"); //COPY text INTO text_copy (WITHOUT LAST CHARACTER WHEN NEWLINE IS AT THE END)