Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
2.1.0
-
None
-
Operating System: Other
Platform: Other
-
15608
Description
File: xerces-c-src2_1_0/src/xercesc/util/Transcoders/Iconv/IconvTransService.cpp
Function:
bool IconvLCPTranscoder::transcode( const XMLCh* const toTranscode
, char* const toFill
, const unsigned int maxBytes)
The following logic is wrong, because wLent is the number of wide characters.
unsigned int wLent = getWideCharLength(toTranscode);
::wcstombs(toFill, wideCharBuf, maxBytes);
// Cap it off just in case
toFill[wLent] = 0;
It should be as follows (error handling is omitted),
size_t mblen;
mblen = ::wcstombs(toFill, wideCharBuf, maxBytes);
toFill[mblen] = 0;