From b04c2a9bdd245124b4ae293387364338f90bf6a5 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Sat, 5 Oct 2019 18:46:38 +0200 Subject: [PATCH] Wide char is longer than one byte --- src/IrrlichtDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- 2.39.5