Set language size to be MAX_DESCRIPTION_LENGTH, not MAX_LINE_LENGTH.

This commit is contained in:
Steve 2018-05-11 08:42:04 +01:00
parent 693ed5f032
commit 7eefeeed86
1 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ static HashTable table;
void setLanguage(char *applicationName, char *languageCode) void setLanguage(char *applicationName, char *languageCode)
{ {
char language[MAX_LINE_LENGTH], c[MAX_LINE_LENGTH]; char language[MAX_DESCRIPTION_LENGTH], c[MAX_LINE_LENGTH];
char **key, **value; char **key, **value;
#ifndef _WIN32 #ifndef _WIN32
char *lang; char *lang;
@ -54,7 +54,7 @@ void setLanguage(char *applicationName, char *languageCode)
if (c[0] != '\0') if (c[0] != '\0')
{ {
STRNCPY(language, c, MAX_LINE_LENGTH); STRNCPY(language, c, MAX_DESCRIPTION_LENGTH);
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, c, MAX_LINE_LENGTH); GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, c, MAX_LINE_LENGTH);
@ -68,14 +68,14 @@ void setLanguage(char *applicationName, char *languageCode)
#else #else
if ((lang = getenv("LC_ALL")) || (lang = getenv("LC_CTYPE")) || (lang = getenv("LANG"))) if ((lang = getenv("LC_ALL")) || (lang = getenv("LC_CTYPE")) || (lang = getenv("LANG")))
{ {
STRNCPY(language, lang, MAX_LINE_LENGTH); STRNCPY(language, lang, MAX_DESCRIPTION_LENGTH);
} }
#endif #endif
} }
else else
{ {
STRNCPY(language, languageCode, MAX_LINE_LENGTH); STRNCPY(language, languageCode, MAX_DESCRIPTION_LENGTH);
} }
strtok(language, "."); strtok(language, ".");