[EU-FOSSA] Check string length to copy to avoid crash in purgeMenuItemString function

This commit is contained in:
Don HO 2019-02-22 19:58:20 +01:00
parent eec82cc2a6
commit 5085d9c95a

View File

@ -361,9 +361,13 @@ bool isInList(const TCHAR *token, const TCHAR *list)
generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand)
{
TCHAR cleanedName[64] = TEXT("");
const size_t cleanedNameLen = 64;
TCHAR cleanedName[cleanedNameLen] = TEXT("");
size_t j = 0;
size_t menuNameLen = lstrlen(menuItemStr);
if (menuNameLen >= cleanedNameLen)
menuNameLen = cleanedNameLen - 1;
for (size_t k = 0 ; k < menuNameLen ; ++k)
{
if (menuItemStr[k] == '\t')