mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Add bounds checks to scriptclass::tokenize()
It could index the `words` array out-of-bounds if there were more than 40 arguments in a command. Not like that would ever happen, but it's still good to be sure.
This commit is contained in:
parent
c7774a3eb9
commit
c3e7ddca9c
1 changed files with 5 additions and 1 deletions
|
@ -56,9 +56,13 @@ void scriptclass::tokenize( std::string t )
|
||||||
{
|
{
|
||||||
tempword += currentletter;
|
tempword += currentletter;
|
||||||
}
|
}
|
||||||
|
if (j >= (int) SDL_arraysize(words))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tempword != "")
|
if (tempword != "" && j < (int) SDL_arraysize(words))
|
||||||
{
|
{
|
||||||
words[j] = tempword;
|
words[j] = tempword;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue