From: Javier Sancho Date: Sat, 5 Oct 2019 16:46:38 +0000 (+0200) Subject: Wide char is longer than one byte X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=b04c2a9bdd245124b4ae293387364338f90bf6a5;p=c-irrlicht.git Wide char is longer than one byte --- diff --git a/src/IrrlichtDevice.cpp b/src/IrrlichtDevice.cpp index d782a66..e032edb 100644 --- a/src/IrrlichtDevice.cpp +++ b/src/IrrlichtDevice.cpp @@ -36,7 +36,7 @@ extern "C" { void irr_IrrlichtDevice_setWindowCaption(void* device, const char* text) { - wchar_t *wtext = (wchar_t*)malloc(strlen(text) + 1); + wchar_t *wtext = (wchar_t*)malloc((strlen(text) + 1) * sizeof(wchar_t)); mbsrtowcs(wtext, &text, strlen(text) + 1, NULL); ((irr::IrrlichtDevice*)device)->setWindowCaption(wtext); }