summaryrefslogtreecommitdiff
path: root/amiga/gui.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2014-05-10 15:22:38 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2014-05-10 15:22:38 +0100
commit318edea47e1ffa29cac9a10dd5de2eeea140eed3 (patch)
tree17747c1d92f4a14ff8eaf2d2080432aa486c52b0 /amiga/gui.c
parent7dc170e6d8f010a9c303fb5766fa7b2e003b12cb (diff)
downloadnetsurf-318edea47e1ffa29cac9a10dd5de2eeea140eed3.tar.gz
netsurf-318edea47e1ffa29cac9a10dd5de2eeea140eed3.tar.bz2
Make mkpath allocate the string buffer for map_filename. Fixes 2119.
Diffstat (limited to 'amiga/gui.c')
-rw-r--r--amiga/gui.c8
1 files 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;
}