| Index: source/i18n/zonemeta.cpp
|
| diff --git a/source/i18n/zonemeta.cpp b/source/i18n/zonemeta.cpp
|
| index 1d34af5a9b7edb3b086b31f77c730466cebcbed6..e2c75e5577b503499895a78c50e0e2c079f01970 100644
|
| --- a/source/i18n/zonemeta.cpp
|
| +++ b/source/i18n/zonemeta.cpp
|
| @@ -1,6 +1,6 @@
|
| /*
|
| *******************************************************************************
|
| -* Copyright (C) 2007-2013, International Business Machines Corporation and
|
| +* Copyright (C) 2007-2014, International Business Machines Corporation and
|
| * others. All Rights Reserved.
|
| *******************************************************************************
|
| */
|
| @@ -235,8 +235,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
|
| return NULL;
|
| }
|
|
|
| - int32_t len = tzid.length();
|
| - if (len > ZID_KEY_MAX) {
|
| + if (tzid.isBogus() || tzid.length() > ZID_KEY_MAX) {
|
| status = U_ILLEGAL_ARGUMENT_ERROR;
|
| return NULL;
|
| }
|
| @@ -268,10 +267,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
|
| // If not, resolve CLDR canonical ID with resource data
|
| UBool isInputCanonical = FALSE;
|
| char id[ZID_KEY_MAX + 1];
|
| - const UChar* idChars = tzid.getBuffer();
|
| -
|
| - u_UCharsToChars(idChars,id,len);
|
| - id[len] = (char) 0; // Make sure it is null terminated.
|
| + tzid.extract(0, 0x7fffffff, id, UPRV_LENGTHOF(id), US_INV);
|
|
|
| // replace '/' with ':'
|
| char *p = id;
|
| @@ -309,7 +305,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
|
| if (derefer == NULL) {
|
| status = U_ILLEGAL_ARGUMENT_ERROR;
|
| } else {
|
| - len = u_strlen(derefer);
|
| + int32_t len = u_strlen(derefer);
|
| u_UCharsToChars(derefer,id,len);
|
| id[len] = (char) 0; // Make sure it is null terminated.
|
|
|
| @@ -717,7 +713,7 @@ ZoneMeta::getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &re
|
| char keyBuf[ZID_KEY_MAX + 1];
|
| int32_t keyLen = 0;
|
|
|
| - if (mzid.length() > ZID_KEY_MAX) {
|
| + if (mzid.isBogus() || mzid.length() > ZID_KEY_MAX) {
|
| result.setToBogus();
|
| return result;
|
| }
|
|
|