diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index 9ce5e087..68603951 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -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')