diff --git a/PythonScript/src/NotepadPlusWrapper.cpp b/PythonScript/src/NotepadPlusWrapper.cpp index 6e613cc6..57caa72e 100644 --- a/PythonScript/src/NotepadPlusWrapper.cpp +++ b/PythonScript/src/NotepadPlusWrapper.cpp @@ -1006,7 +1006,7 @@ intptr_t NotepadPlusWrapper::getCurrentNativeLangEncoding() boost::python::str NotepadPlusWrapper::getLanguageName(int langType) { int size = callNotepad(NPPM_GETLANGUAGENAME, langType, NULL); - wchar_t* result(new wchar_t[size]); + wchar_t* result(new wchar_t[size+1]); callNotepad(NPPM_GETLANGUAGENAME, langType, reinterpret_cast(result)); std::shared_ptr languageName = WcharMbcsConverter::tchar2char(result); return boost::python::str(const_cast(languageName.get())); @@ -1015,7 +1015,7 @@ boost::python::str NotepadPlusWrapper::getLanguageName(int langType) boost::python::str NotepadPlusWrapper::getLanguageDesc(int langType) { int size = callNotepad(NPPM_GETLANGUAGEDESC, langType, NULL); - wchar_t* result(new wchar_t[size]); + wchar_t* result(new wchar_t[size+1]); callNotepad(NPPM_GETLANGUAGEDESC, langType, reinterpret_cast(result)); std::shared_ptr languageName = WcharMbcsConverter::tchar2char(result); return boost::python::str(const_cast(languageName.get()));