ICU-1923 fix buffer overrun when copying from temp buffer

X-SVN-Rev: 8770
This commit is contained in:
Markus Scherer 2002-06-03 03:35:08 +00:00
parent 0a70506190
commit 4f02d44cc3

View File

@ -198,7 +198,10 @@ u_strCaseMap(UChar *dest, int32_t destCapacity,
if(temp!=dest) {
/* copy the result string to the destination buffer */
if(destLength>0) {
uprv_memmove(dest, temp, destLength*U_SIZEOF_UCHAR);
int32_t copyLength= destLength<=destCapacity ? destLength : destCapacity;
if(copyLength>0) {
uprv_memmove(dest, temp, copyLength*U_SIZEOF_UCHAR);
}
}
if(temp!=buffer) {
uprv_free(temp);