ICU-8097 Fix buffer overflow problems in uscript_getCode()

X-SVN-Rev: 28953
This commit is contained in:
John Emmons 2010-10-29 15:41:56 +00:00
parent 334ad85355
commit ad865ff7e7

View File

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 1997-2008, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@ -62,7 +62,7 @@ uscript_getCode(const char* nameOrAbbrOrLocale,
u_UCharsToChars(name,cName,len);
code = (UScriptCode) u_getPropertyValueEnum(UCHAR_SCRIPT, cName);
/* got the script code now fill in the buffer */
if(numFilled<=capacity){
if(numFilled<capacity){
*(fillIn)++=code;
numFilled++;
}else{
@ -85,7 +85,7 @@ uscript_getCode(const char* nameOrAbbrOrLocale,
}
if(code!=(UScriptCode)UCHAR_INVALID_CODE){
/* we found it */
if(numFilled<=capacity){
if(numFilled<capacity){
*(fillIn)++=code;
numFilled++;
}else{