mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-18 05:33:52 +01:00
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 )
|
if ( sourceSize )
|
||||||
{
|
{
|
||||||
destination.reserve(sourceSize+1);
|
destination.reserve(sizeof(wchar_t)*sourceSize+1);
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable: 4996) // 'wcstombs': This function or variable may be unsafe. Consider using wcstombs_s instead.
|
#pragma warning(disable: 4996) // 'wcstombs': This function or variable may be unsafe. Consider using wcstombs_s instead.
|
||||||
#endif
|
#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)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user