From cb9bf0929b6fdc3366fa385d396a0a8086f82896 Mon Sep 17 00:00:00 2001 From: brankoku <48296877+brankoku@users.noreply.github.com> Date: Thu, 27 Feb 2020 23:20:30 -0500 Subject: [PATCH] `LoadText()` tweak 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);