mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-8629 fix unsafe memcpy of UnicodeStrings.
X-SVN-Rev: 30254
This commit is contained in:
parent
5a0a5a7d87
commit
fe56e19f40
1 changed files with 7 additions and 3 deletions
|
@ -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<listSize; ++i) {
|
||||
newStrings[i] = strings[i];
|
||||
}
|
||||
|
||||
#ifdef INSTRUMENT_STRING_LIST
|
||||
int32_t _h = listSize / STRING_LIST_BUFFER_SIZE;
|
||||
|
|
Loading…
Add table
Reference in a new issue