forked from Mirrorlandia_minetest/irrlicht
Fix buffer size for wchar-multibyte conversion
This commit is contained in:
parent
1cf0f3bef0
commit
9b541f2948
@ -1503,12 +1503,12 @@ static size_t wStringToMultibyte(string<c8>& destination, const wchar_t* source,
|
||||
{
|
||||
if ( sourceSize )
|
||||
{
|
||||
destination.reserve(sourceSize+1);
|
||||
destination.reserve(sizeof(wchar_t)*sourceSize+1);
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4996) // 'wcstombs': This function or variable may be unsafe. Consider using wcstombs_s instead.
|
||||
#endif
|
||||
const size_t written = wcstombs(destination.array, source, (size_t)sourceSize);
|
||||
const size_t written = wcstombs(destination.array, source, destination.allocated-1);
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user