summaryrefslogtreecommitdiff
path: root/src/win32.cpp
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2007-07-27 23:49:48 +0000
committerKUDr <kudr@openttd.org>2007-07-27 23:49:48 +0000
commit5eb4036eb27ad87d281f8671285abb0409ba4ee7 (patch)
tree35bcb99b7d32b03af9b042857fb6a8135d03b550 /src/win32.cpp
parent51b26f96d2bef9038cbac44d0f9ce528a7942d05 (diff)
downloadopenttd-5eb4036eb27ad87d281f8671285abb0409ba4ee7.tar.xz
(svn r10713) -Cleanup (r10711): too long string buffers, unsafe sprintf used (Darkvater)
Diffstat (limited to 'src/win32.cpp')
-rw-r--r--src/win32.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/win32.cpp b/src/win32.cpp
index 5bbc05524..7848a49fc 100644
--- a/src/win32.cpp
+++ b/src/win32.cpp
@@ -1268,14 +1268,13 @@ HRESULT OTTDSHGetFolderPath(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags,
/** Determine the current user's locale. */
const char *GetCurrentLocale(const char *)
{
- char lang[32], country[32];
- static char retbuf[64];
+ char lang[9], country[9];
if (GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, lang, lengthof(lang)) == 0 ||
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, country, lengthof(country)) == 0) {
/* Unable to retrieve the locale. */
return NULL;
}
/* Format it as 'en_us'. */
- sprintf(retbuf, "%c%c_%c%c", lang[0], lang[1], country[0], country[1]);
+ static char retbuf[6] = {lang[0], lang[1], '_', country[0], country[1], 0};
return retbuf;
}