ICU-2341 fix buffer overflow in uconv with utf-16/32 converters that add a BOM

X-SVN-Rev: 10182
This commit is contained in:
Markus Scherer 2002-11-07 02:49:10 +00:00
parent 3c4333f7e1
commit 97d2e85372

View file

@ -555,7 +555,9 @@ static UBool convertFile(const char *pname,
// the codepage that uses the most bytes and multiply it against
// the buffer size.
tobufsz = bufsz * ucnv_getMaxCharSize(convto);
// use bufsz+1 to allow for additional BOM/signature character (U+FEFF)
tobufsz = (bufsz+1) * ucnv_getMaxCharSize(convto);
buf = new char[tobufsz];
unibuf = new UChar[bufsz];