]> granicus.if.org Git - icu/commitdiff
ICU-13263 uprv_convertToPosix uses a local stack variable out of scope.
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Wed, 5 Jul 2017 18:46:18 +0000 (18:46 +0000)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Wed, 5 Jul 2017 18:46:18 +0000 (18:46 +0000)
X-SVN-Rev: 40234

icu4c/source/common/locmap.cpp

index 18994fb8602a9d6e797692ba7631a5fe45431793..ea4d61efe4b5737df240ff60e7b34bbd23960c60 100644 (file)
@@ -1062,6 +1062,8 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
     const char *pPosixID = NULL;
 
 #ifdef USE_WINDOWS_LCID_MAPPING_API
+    char locName[LOCALE_NAME_MAX_LENGTH] = {};      // ICU name can't be longer than Windows name
+
     // Note: Windows primary lang ID 0x92 in LCID is used for Central Kurdish and
     // GetLocaleInfo() maps such LCID to "ku". However, CLDR uses "ku" for
     // Northern Kurdish and "ckb" for Central Kurdish. For this reason, we cannot
@@ -1069,7 +1071,6 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
     if ((hostid & 0x3FF) != 0x92) {
         int32_t tmpLen = 0;
         UChar windowsLocaleName[LOCALE_NAME_MAX_LENGTH];  // ULOC_FULLNAME_CAPACITY > LOCALE_NAME_MAX_LENGTH
-        char locName[LOCALE_NAME_MAX_LENGTH];             // ICU name can't be longer than Windows name
 
         // Note: LOCALE_ALLOW_NEUTRAL_NAMES was enabled in Windows7+, prior versions did not handle neutral (no-region) locale names.
         tmpLen = LCIDToLocaleName(hostid, (PWSTR)windowsLocaleName, UPRV_LENGTHOF(windowsLocaleName), LOCALE_ALLOW_NEUTRAL_NAMES);