From 572969d8b7889856bf59a470c5ffe56a2d14761f Mon Sep 17 00:00:00 2001 From: brankoku <48296877+brankoku@users.noreply.github.com> Date: Fri, 28 Feb 2020 02:23:05 -0500 Subject: [PATCH] `LoadText()` tweak (#1113) Guarantee string is zero-terminated --- src/rlgl.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rlgl.h b/src/rlgl.h index 0bbbf2fd1..f2c796dee 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -3013,8 +3013,10 @@ char *LoadText(const char *fileName) if (count < size) { text = RL_REALLOC(text, count + 1); - text[count] = '\0'; } + + // zero-terminate the string + text[count] = '\0'; } fclose(textFile);