Fix the crash issue in UDL

Fixes #1887, Closes #1965
Fix crash issue while UDL's user keyword list is too long.
This commit is contained in:
Christian Grasser 2016-06-14 21:36:25 +02:00 committed by Don HO
parent 79a9f42e37
commit fe7257faf1
2 changed files with 9 additions and 2 deletions

View File

@ -3170,8 +3170,15 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
if (globalMappper().keywordIdMapper.find(keywordsName) != globalMappper().keywordIdMapper.end())
{
id = globalMappper().keywordIdMapper[keywordsName];
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)"));
}
}
}
}
}

View File

@ -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] == '"')
{