From d3bd8eaf79992bd5cdf442be33263e9c68c9c839 Mon Sep 17 00:00:00 2001 From: Walter Julius Hennecke Date: Thu, 16 May 2013 22:05:18 +0200 Subject: [PATCH] Changed G_LoadServerChangeFile from fixed buffer size to dynamic buffer size --- code/game/g_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/g_main.c b/code/game/g_main.c index 60676b1..215c658 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -1100,9 +1100,9 @@ static void G_LoadServerChangeFile(void) { } // TODO dynamic buffer size - buffer = (char *)malloc(32000 * sizeof(char)); + buffer = (char *)malloc((file_len + 1) * sizeof(char)); if(!buffer) { - G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", 32000 * sizeof(char) ); + G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", (file_len + 1) * sizeof(char) ); trap_FS_FCloseFile(f); return; }