From e6b5c6a0ec54777d66194e0c01861a34f03b4aa9 Mon Sep 17 00:00:00 2001 From: VHANTOMI Date: Wed, 7 Oct 2026 06:29:02 +0200 Subject: [PATCH] Fix memory allocation for gsFont path strings Allocate additional space for null terminator in gsFont paths. --- ee/toolkit/src/gsToolkit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/toolkit/src/gsToolkit.c b/ee/toolkit/src/gsToolkit.c index eadacda..0eeab66 100644 --- a/ee/toolkit/src/gsToolkit.c +++ b/ee/toolkit/src/gsToolkit.c @@ -988,7 +988,7 @@ GSFONT *gsKit_init_font(u8 type, char *path) GSFONT *gsFont = calloc(1,sizeof(GSFONT)); gsFont->Texture = calloc(1,sizeof(GSTEXTURE)); - gsFont->Path = calloc(1,strlen(path)); + gsFont->Path = calloc(1, strlen(path) + 1); gsFont->Additional=calloc(1,sizeof(short)*256); gsFont->Type = type; @@ -996,7 +996,7 @@ GSFONT *gsKit_init_font(u8 type, char *path) if(gsFont->Type == GSKIT_FTYPE_BMP_DAT || gsFont->Type == GSKIT_FTYPE_PNG_DAT) { - gsFont->Path_DAT = calloc(1,strlen(path)); + gsFont->Path_DAT = calloc(1, strlen(path) + 1); strcpy(gsFont->Path_DAT, path); if(gsFont->Type == GSKIT_FTYPE_BMP_DAT) tmp = strstr(gsFont->Path_DAT, ".bmp");