From fe56e19f4041127350affc39021bb9f4b9f989db Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Wed, 29 Jun 2011 23:25:35 +0000 Subject: [PATCH] ICU-8629 fix unsafe memcpy of UnicodeStrings. X-SVN-Rev: 30254 --- icu4c/source/i18n/colldata.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/icu4c/source/i18n/colldata.cpp b/icu4c/source/i18n/colldata.cpp index 69ea3043cd..6d73aeacc4 100644 --- a/icu4c/source/i18n/colldata.cpp +++ b/icu4c/source/i18n/colldata.cpp @@ -234,10 +234,14 @@ void StringList::add(const UnicodeString *string, UErrorCode &status) if (listSize >= listMax) { int32_t newMax = listMax + STRING_LIST_BUFFER_SIZE; - UnicodeString *newStrings = new UnicodeString[newMax]; - - uprv_memcpy(newStrings, strings, listSize * sizeof(UnicodeString)); + if (newStrings == NULL) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + for (int32_t i=0; i