From: Andy Heninger Date: Sun, 12 Nov 2017 02:53:40 +0000 (+0000) Subject: ICU-13457 Fix initialization & copying of Calendar::validLocale & actualLocale. X-Git-Tag: release-61-rc~186 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2cf99c6777ae16c10ef967988eb5ef6306486f5;p=icu ICU-13457 Fix initialization & copying of Calendar::validLocale & actualLocale. X-SVN-Rev: 40670 --- diff --git a/icu4c/source/i18n/calendar.cpp b/icu4c/source/i18n/calendar.cpp index 12966a739a3..4e22dff2644 100644 --- a/icu4c/source/i18n/calendar.cpp +++ b/icu4c/source/i18n/calendar.cpp @@ -706,7 +706,9 @@ fTime(0), fLenient(TRUE), fZone(NULL), fRepeatedWallTime(UCAL_WALLTIME_LAST), -fSkippedWallTime(UCAL_WALLTIME_LAST) +fSkippedWallTime(UCAL_WALLTIME_LAST), +validLocale(""), +actualLocale("") { clear(); if (U_FAILURE(success)) { @@ -732,7 +734,9 @@ fTime(0), fLenient(TRUE), fZone(NULL), fRepeatedWallTime(UCAL_WALLTIME_LAST), -fSkippedWallTime(UCAL_WALLTIME_LAST) +fSkippedWallTime(UCAL_WALLTIME_LAST), +validLocale(""), +actualLocale("") { if (U_FAILURE(success)) { return; @@ -764,7 +768,9 @@ fTime(0), fLenient(TRUE), fZone(NULL), fRepeatedWallTime(UCAL_WALLTIME_LAST), -fSkippedWallTime(UCAL_WALLTIME_LAST) +fSkippedWallTime(UCAL_WALLTIME_LAST), +validLocale(""), +actualLocale("") { if (U_FAILURE(success)) { return; @@ -822,8 +828,8 @@ Calendar::operator=(const Calendar &right) fWeekendCease = right.fWeekendCease; fWeekendCeaseMillis = right.fWeekendCeaseMillis; fNextStamp = right.fNextStamp; - uprv_strcpy(validLocale, right.validLocale); - uprv_strcpy(actualLocale, right.actualLocale); + uprv_strncpy(validLocale, right.validLocale, sizeof(validLocale)); + uprv_strncpy(actualLocale, right.actualLocale, sizeof(actualLocale)); } return *this;