From fe7257faf12516c71ff048d09dbaa212ad017dec Mon Sep 17 00:00:00 2001 From: Christian Grasser Date: Tue, 14 Jun 2016 21:36:25 +0200 Subject: [PATCH] Fix the crash issue in UDL Fixes #1887, Closes #1965 Fix crash issue while UDL's user keyword list is too long. --- PowerEditor/src/Parameters.cpp | 9 ++++++++- PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 4f9f86c49..f2f5eea83 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -3170,7 +3170,14 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node) if (globalMappper().keywordIdMapper.find(keywordsName) != globalMappper().keywordIdMapper.end()) { id = globalMappper().keywordIdMapper[keywordsName]; - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], kwl); + if (_tcslen(kwl) < max_char) + { + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], kwl); + } + else + { + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], TEXT("imported string too long, needs to be < max_char(30720)")); + } } } } diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 7f5570d9d..269d99d60 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -720,7 +720,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) bool inSingleQuote = false; bool nonWSFound = false; int index = 0; - for (size_t j=0, len = strlen(keyWords_char); j