changeset 13668:136bcee0955a

8203324: Use out of scope in getMacOSXLocale of java_props_macosx.c:120 Reviewed-by: shade, andrew
author stooke
date Tue, 03 Sep 2019 06:45:03 +0100
parents b4522ab88a12
children d44a3f4b841f
files src/solaris/native/java/lang/java_props_macosx.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/java/lang/java_props_macosx.c	Tue Sep 03 05:19:25 2019 +0100
+++ b/src/solaris/native/java/lang/java_props_macosx.c	Tue Sep 03 06:45:03 2019 +0100
@@ -47,6 +47,8 @@
 #define LOCALEIDLENGTH  128
 char *getMacOSXLocale(int cat) {
     const char* retVal = NULL;
+    char languageString[LOCALEIDLENGTH];
+    char localeString[LOCALEIDLENGTH];
 
     switch (cat) {
     case LC_MESSAGES:
@@ -66,7 +68,6 @@
                 CFRelease(languages);
                 return NULL;
             }
-            char languageString[LOCALEIDLENGTH];
             if (CFStringGetCString(primaryLanguage, languageString,
                                    LOCALEIDLENGTH, CFStringGetSystemEncoding()) == false) {
                 CFRelease(languages);
@@ -81,7 +82,6 @@
             // from Portuguese in Portugal), but this is missing when using the
             // "Portuguese (Brazil)" language.
             // If language is "pt" and the current locale is pt_BR, return pt_BR.
-            char localeString[LOCALEIDLENGTH];
             if (strcmp(retVal, "pt") == 0 &&
                     CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
                                        localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) &&
@@ -92,7 +92,6 @@
         break;
     default:
         {
-            char localeString[LOCALEIDLENGTH];
             if (!CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
                                     localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) {
                 return NULL;