edits cleanup:

- only allow reasonable file sizes
 - only allow one Steps per edit file
 - only allow 5 edits per-song, per-profile
This commit is contained in:
Chris Danford
2004-04-23 00:26:51 +00:00
parent d3f3db2751
commit cca71d1d3f
9 changed files with 51 additions and 19 deletions
+6 -2
View File
@@ -489,7 +489,7 @@ bool Profile::LoadAllFromDir( CString sDir, bool bRequireSignature )
// Don't unreasonably large stats.xml files.
//
int iBytes = FILEMAN->GetFileSizeInBytes( fn );
if( iBytes > REASONABLE_STATS_XML_SIZE_BYTES )
if( iBytes > MAX_STATS_XML_SIZE_BYTES )
{
LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
break;
@@ -591,12 +591,16 @@ bool Profile::SaveAllToDir( CString sDir, bool bSignData ) const
SaveStatsWebPageToDir( sDir );
//
// create edits dir
//
CString sEditsTempFile = sDir + EDITS_SUBDIR + "temp";
RageFile f;
f.Open( sDir + EDITS_SUBDIR + "temp", RageFile::WRITE );
f.Close();
FILEMAN->FlushDirCache( sDir + EDITS_SUBDIR );
FILEMAN->Remove( sEditsTempFile );
return true;
@@ -767,7 +771,7 @@ void Profile::LoadEditableDataFromDir( CString sDir )
// Don't load unreasonably large editable.xml files.
//
int iBytes = FILEMAN->GetFileSizeInBytes( fn );
if( iBytes > REASONABLE_EDITABLE_INI_SIZE_BYTES )
if( iBytes > MAX_EDITABLE_INI_SIZE_BYTES )
{
LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
return;