xstring.cpp:
- Fix potential buffer overruns in FromUtf8() on non-Windows systems.
This commit is contained in:
parent
1a48e36abb
commit
58faffaa26
|
@ -87,10 +87,18 @@
|
|||
bit mask & shift operations.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
typedef unsigned long UTF32; /* at least 32 bits */
|
||||
typedef unsigned short UTF16; /* at least 16 bits */
|
||||
typedef unsigned char UTF8; /* typically 8 bits */
|
||||
typedef unsigned char Boolean; /* 0 or 1 */
|
||||
#if defined(_MSC_VER)
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef uint32_t UTF32;
|
||||
typedef uint16_t UTF16;
|
||||
typedef uint8_t UTF8;
|
||||
typedef uint8_t Boolean; /* 0 or 1 */
|
||||
|
||||
/* Some fundamental constants */
|
||||
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
|
||||
|
|
|
@ -645,7 +645,7 @@ namespace UtfConverter
|
|||
const UTF8* sourcestart = reinterpret_cast<const UTF8*>(utf8string.c_str());
|
||||
const UTF8* sourceend = sourcestart + widesize;
|
||||
UTF32* targetstart = reinterpret_cast<UTF32*>(widestringnative);
|
||||
UTF32* targetend = targetstart + widesize;
|
||||
UTF32* targetend = targetstart + widesize+1;
|
||||
ConversionResult res = ConvertUTF8toUTF32(&sourcestart, sourceend, &targetstart, targetend, strictConversion);
|
||||
if (res != conversionOK)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue