fixed why2_send_socket's text_copy allocation size

This commit is contained in:
Václav Šmejkal 2023-04-20 21:42:53 +02:00
parent 9bcbe4c2d2
commit 68a484cae1
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -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)