[EU-FOSSA] Check string length to copy to avoid crash in purgeMenuItemString function
This commit is contained in:
parent
eec82cc2a6
commit
5085d9c95a
@ -361,9 +361,13 @@ bool isInList(const TCHAR *token, const TCHAR *list)
|
|||||||
|
|
||||||
generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand)
|
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 j = 0;
|
||||||
size_t menuNameLen = lstrlen(menuItemStr);
|
size_t menuNameLen = lstrlen(menuItemStr);
|
||||||
|
if (menuNameLen >= cleanedNameLen)
|
||||||
|
menuNameLen = cleanedNameLen - 1;
|
||||||
|
|
||||||
for (size_t k = 0 ; k < menuNameLen ; ++k)
|
for (size_t k = 0 ; k < menuNameLen ; ++k)
|
||||||
{
|
{
|
||||||
if (menuItemStr[k] == '\t')
|
if (menuItemStr[k] == '\t')
|
||||||
|
Loading…
Reference in New Issue
Block a user