[EU-FOSSA] Fix stack overflow in extractSymbol function
This commit is contained in:
parent
c906af27b2
commit
e691370e4f
@ -3952,9 +3952,10 @@ void Notepad_plus::showFunctionComp()
|
|||||||
static generic_string extractSymbol(TCHAR firstChar, TCHAR secondChar, const TCHAR *str2extract)
|
static generic_string extractSymbol(TCHAR firstChar, TCHAR secondChar, const TCHAR *str2extract)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
TCHAR extracted[128] = TEXT("");
|
const size_t extractedLen = 128;
|
||||||
|
TCHAR extracted[extractedLen] = {'\0'};
|
||||||
|
|
||||||
for (size_t i = 0, j = 0, len = lstrlen(str2extract) ; i < len ; ++i)
|
for (size_t i = 0, j = 0, len = lstrlen(str2extract) ; i < len && j < extractedLen - 1; ++i)
|
||||||
{
|
{
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
@ -3964,7 +3965,6 @@ static generic_string extractSymbol(TCHAR firstChar, TCHAR secondChar, const TCH
|
|||||||
return generic_string(extracted);
|
return generic_string(extracted);
|
||||||
}
|
}
|
||||||
extracted[j++] = str2extract[i];
|
extracted[j++] = str2extract[i];
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user