mirror of
https://github.com/accelerator74/Cleaner.git
synced 2025-12-09 03:28:28 +00:00
fixup offbyone error caused by fgetc incrementing lines at EOF, leading to hangs and crashes
This commit is contained in:
parent
e975691c7c
commit
ae28a5b983
@ -83,7 +83,8 @@ bool Cleaner::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
|
|
||||||
rewind(file);
|
rewind(file);
|
||||||
|
|
||||||
g_szStrings = new char*[lines];
|
// need lines+1 because the feget runs ++lines even if it's at EOF
|
||||||
|
g_szStrings = new char*[lines+1];
|
||||||
|
|
||||||
while (!feof(file))
|
while (!feof(file))
|
||||||
{
|
{
|
||||||
@ -170,7 +171,12 @@ void Cleaner::SDK_OnUnload()
|
|||||||
g_pDetour = NULL;
|
g_pDetour = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
// we set lines to lines+1 earlier so this needs to be <=
|
||||||
|
for (int i = 0; i <= g_iStrings; ++i)
|
||||||
|
=======
|
||||||
for (int i = 0; i < g_iStrings; ++i)
|
for (int i = 0; i < g_iStrings; ++i)
|
||||||
|
>>>>>>> a8148454bb66da9cd38df0878571524db7a658d6
|
||||||
{
|
{
|
||||||
delete [] g_szStrings[i];
|
delete [] g_szStrings[i];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user