From: Apple Date: Thu, 6 Dec 2018 05:43:36 +0000 (+0000) Subject: ICU-62108.0.1.tar.gz X-Git-Tag: macos-10141^0 X-Git-Url: https://git.saurik.com/apple/icu.git/commitdiff_plain/cecc3f9394f261e71def48cf396d137687dbd0a7 ICU-62108.0.1.tar.gz --- diff --git a/icuSources/common/putil.cpp b/icuSources/common/putil.cpp index 15265972..4fcabd22 100644 --- a/icuSources/common/putil.cpp +++ b/icuSources/common/putil.cpp @@ -1713,7 +1713,8 @@ The leftmost codepage (.xxx) wins. /* Note that we scan the *uncorrected* ID. */ if ((p = uprv_strrchr(posixID, '@')) != NULL) { if (correctedPOSIXLocale == NULL) { - correctedPOSIXLocale = static_cast(uprv_malloc(uprv_strlen(posixID)+1)); + /* new locale can be 1 char longer than old one if @ -> __ */ + correctedPOSIXLocale = static_cast(uprv_malloc(uprv_strlen(posixID)+2)); /* Exit on memory allocation error. */ if (correctedPOSIXLocale == NULL) { return NULL; @@ -1730,7 +1731,7 @@ The leftmost codepage (.xxx) wins. } if (uprv_strchr(correctedPOSIXLocale,'_') == NULL) { - uprv_strcat(correctedPOSIXLocale, "__"); /* aa@b -> aa__b */ + uprv_strcat(correctedPOSIXLocale, "__"); /* aa@b -> aa__b (note this can make the new locale 1 char longer) */ } else { uprv_strcat(correctedPOSIXLocale, "_"); /* aa_CC@b -> aa_CC_b */