1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-25 05:58:30 +02:00

Don't let custom levels tamper with main game save data

Someone being mean could've overwritten the telesaves of unsuspecting
players, or unlocked a bunch of stuff which they shouldn't have for
those players, using things like the telesave() command and gamestates.
To prevent this, return early in Game::savequick(), Game::savetele(),
and Game::unlocknum() if we are in custommode.
This commit is contained in:
Misa 2020-03-15 08:17:12 -07:00 committed by Ethan Lee
parent cad0b4fcc4
commit cfd355bf4d

View File

@ -4208,6 +4208,12 @@ void Game::deletestats( mapclass& map, Graphics& dwgfx )
void Game::unlocknum( int t, mapclass& map, Graphics& dwgfx )
{
if (map.custommode)
{
//Don't let custom levels unlock things!
return;
}
unlock[t] = true;
savestats(map, dwgfx);
}
@ -5661,6 +5667,12 @@ void Game::savetele( mapclass& map, entityclass& obj, musicclass& music )
//Save to the telesave cookie
telecookieexists = true;
if (map.custommode)
{
//Don't trash save data!
return;
}
TiXmlDocument doc;
TiXmlElement* msg;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
@ -5904,6 +5916,12 @@ void Game::savequick( mapclass& map, entityclass& obj, musicclass& music )
{
quickcookieexists = true;
if (map.custommode)
{
//Don't trash save data!
return;
}
TiXmlDocument doc;
TiXmlElement* msg;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );