Fix the crash issue in UDL

Fixes #1887, Closes #1965
Fix crash issue while UDL's user keyword list is too long.
pull/1930/merge
Christian Grasser 9 years ago committed by Don HO
parent 79a9f42e37
commit fe7257faf1

@ -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)"));
}
}
}
}

@ -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<len; ++j)
for (size_t j=0, len = strlen(keyWords_char); j<len && index < (max_char-1); ++j)
{
if (!inSingleQuote && keyWords_char[j] == '"')
{

Loading…
Cancel
Save