]> git.saurik.com Git - apple/icu.git/commitdiff
ICU-461.18.tar.gz mac-os-x-1075 v461.18
authorApple <opensource@apple.com>
Thu, 8 Mar 2012 22:16:41 +0000 (22:16 +0000)
committerApple <opensource@apple.com>
Thu, 8 Mar 2012 22:16:41 +0000 (22:16 +0000)
icuSources/common/uloc.c

index 64465032ae3a0f38db5ac1ee9d5cbc6f52bb1f6b..aad031e5ccc7fa8b6e37402873123adca6e1b1e9 100644 (file)
@@ -1797,7 +1797,7 @@ _canonicalize(const char* localeID,
                 int32_t variantLen = _deleteVariant(variant, uprv_min(variantSize, (nameCapacity-len)), variantToCompare, n);
                 len -= variantLen;
                 if (variantLen > 0) {
-                    if (name[len-1] == '_') { /* delete trailing '_' */
+                    if (len > 0 && name[len-1] == '_') { /* delete trailing '_' */
                         --len;
                     }
                     addKeyword = VARIANT_MAP[j].keyword;
@@ -1805,7 +1805,7 @@ _canonicalize(const char* localeID,
                     break;
                 }
             }
-            if (name[len-1] == '_') { /* delete trailing '_' */
+            if (len > 0 && len <= nameCapacity && name[len-1] == '_') { /* delete trailing '_' */
                 --len;
             }
         }