From c6093a89267a2d1a736ca87b85dac75e5c575248 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Thu, 23 Feb 2023 09:54:10 +0100 Subject: [PATCH] added terminating character to why2_read_socket --- src/chat/misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/chat/misc.c b/src/chat/misc.c index b28ecaa..6dc2b24 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -215,6 +215,8 @@ char *why2_read_socket(int socket) //READ FINAL MESSAGE if (recv(socket, content_buffer, content_size, 0) != content_size - 2) fprintf(stderr, "Socket probably read wrongly!\n"); + content_buffer[content_size - 2] = '\0'; //TODO: Possible problems + return content_buffer; }