diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 9eb4c6352..112909658 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -162,13 +162,14 @@ void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer em_address) { - if (!em_address.IsValid()) + const size_t maxLength = 2048; + if (!em_address.IsValid() || _string.length() >= maxLength) { _string = L""; return; } - wchar_t stringBuffer[2048]; + wchar_t stringBuffer[maxLength]; wchar_t *string = stringBuffer; auto input = em_address;