From 318edea47e1ffa29cac9a10dd5de2eeea140eed3 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 10 May 2014 15:22:38 +0100 Subject: Make mkpath allocate the string buffer for map_filename. Fixes 2119. --- amiga/gui.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 4801325c4..7ea2334a1 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -393,14 +393,16 @@ STRPTR ami_locale_langs(void) bool ami_gui_map_filename(char **remapped, const char *path, const char *file, const char *map) { BPTR fh = 0; - char mapfile[1024]; - size_t mapfile_size = 1024; + char *mapfile = NULL; + size_t mapfile_size = 0; char buffer[1024]; char *realfname; bool found = false; amiga_mkpath(&mapfile, &mapfile_size, 2, path, map); + if(mapfile == NULL) return false; + if(fh = FOpen(mapfile, MODE_OLDFILE, 0)) { while(FGets(fh, buffer, 1024) != 0) @@ -427,6 +429,8 @@ bool ami_gui_map_filename(char **remapped, const char *path, const char *file, c if(found == false) *remapped = strdup(file); else LOG(("Remapped %s to %s in path %s using %s", file, *remapped, path, map)); + free(mapfile); + return found; } -- cgit v1.2.3