From 7b14fcb4d9224f79629853d86affd46f9014b43b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 5 Jun 2024 05:48:39 -0700 Subject: [PATCH] Stack allocation never happened, so explicitly allocate the path --- src/file/SDL_iostream.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/file/SDL_iostream.c b/src/file/SDL_iostream.c index a99b6d1cd5..4426fd66af 100644 --- a/src/file/SDL_iostream.c +++ b/src/file/SDL_iostream.c @@ -577,13 +577,11 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode) return SDL_IOFromFP(fp, SDL_TRUE); } else { /* Try opening it from internal storage if it's a relative path */ - // !!! FIXME: why not just "char path[PATH_MAX];" - char *path = SDL_stack_alloc(char, PATH_MAX); + char *path = NULL; + SDL_asprintf(&path, "%s/%s", SDL_AndroidGetInternalStoragePath(), file); if (path) { - SDL_snprintf(path, PATH_MAX, "%s/%s", - SDL_AndroidGetInternalStoragePath(), file); FILE *fp = fopen(path, mode); - SDL_stack_free(path); + SDL_free(path); if (fp) { if (!IsRegularFileOrPipe(fp)) { fclose(fp);