diff options
author | peter1138 <peter1138@openttd.org> | 2006-01-31 12:08:49 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-01-31 12:08:49 +0000 |
commit | 9fd6b1009e148ae5cd110ee3682650e45c0a7b6c (patch) | |
tree | fb209c59882db9fea045debd6dbd9b5ce7a9f708 /win32.c | |
parent | 822afdcecd8b91236daae33ae5ee6504ccc09882 (diff) | |
download | openttd-9fd6b1009e148ae5cd110ee3682650e45c0a7b6c.tar.xz |
(svn r3496) - Validate filename titles before they get displayed. This avoids crashes with UTF-8 encoded or bad filenames by replacing undisplayable characters with a '?'
Diffstat (limited to 'win32.c')
-rw-r--r-- | win32.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -686,6 +686,7 @@ FiosItem *FiosGetSavegameList(int *num, int mode) fios->mtime = 0; ttd_strlcpy(fios->name, fd.cFileName, lengthof(fios->name)); snprintf(fios->title, lengthof(fios->title), "%s\\ (Directory)", fd.cFileName); + str_validate(fios->title); } } while (FindNextFile(h, &fd)); FindClose(h); @@ -726,6 +727,7 @@ FiosItem *FiosGetSavegameList(int *num, int mode) *t = '\0'; // strip extension ttd_strlcpy(fios->title, fd.cFileName, lengthof(fios->title)); + str_validate(fios->title); } else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO) { if (strcasecmp(t, ".ss1") == 0 || strcasecmp(t, ".sv1") == 0 || @@ -800,6 +802,7 @@ FiosItem *FiosGetScenarioList(int *num, int mode) fios->mtime = 0; ttd_strlcpy(fios->name, fd.cFileName, lengthof(fios->name)); snprintf(fios->title, lengthof(fios->title), "%s\\ (Directory)", fd.cFileName); + str_validate(fios->title); } } while (FindNextFile(h, &fd)); FindClose(h); @@ -839,6 +842,7 @@ FiosItem *FiosGetScenarioList(int *num, int mode) *t = '\0'; // strip extension ttd_strlcpy(fios->title, fd.cFileName, lengthof(fios->title)); + str_validate(fios->title); } else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO || mode == SLD_NEW_GAME) { if (strcasecmp(t, ".sv0") == 0 || |