Fix a couple possible overflows
This commit is contained in:
@@ -297,6 +297,15 @@ void SongManager::FreeSongs()
|
|||||||
m_sGroupBannerPaths.clear();
|
m_sGroupBannerPaths.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CString ReadLine( FILE *fp )
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
fgets( buf, sizeof(buf), fp );
|
||||||
|
|
||||||
|
CString ret( buf );
|
||||||
|
TrimRight( ret );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SongManager::ReadNoteScoresFromFile( CString fn, int c )
|
void SongManager::ReadNoteScoresFromFile( CString fn, int c )
|
||||||
@@ -376,11 +385,11 @@ void SongManager::ReadCourseScoresFromFile( CString fn, int c )
|
|||||||
{
|
{
|
||||||
while( fp && !feof(fp) )
|
while( fp && !feof(fp) )
|
||||||
{
|
{
|
||||||
char szPath[256];
|
CString path=ReadLine( fp );
|
||||||
fscanf(fp, "%[^\n]\n", szPath);
|
|
||||||
Course* pCourse = GetCourseFromPath( szPath );
|
Course* pCourse = GetCourseFromPath( path );
|
||||||
if( pCourse == NULL )
|
if( pCourse == NULL )
|
||||||
pCourse = GetCourseFromName( szPath );
|
pCourse = GetCourseFromName( path );
|
||||||
|
|
||||||
for( int i=0; i<NUM_STEPS_TYPES; i++ )
|
for( int i=0; i<NUM_STEPS_TYPES; i++ )
|
||||||
if( !feof(fp) )
|
if( !feof(fp) )
|
||||||
@@ -437,11 +446,11 @@ void SongManager::ReadCourseRankingsFromFile( CString fn )
|
|||||||
{
|
{
|
||||||
while( fp && !feof(fp) )
|
while( fp && !feof(fp) )
|
||||||
{
|
{
|
||||||
char szPath[256];
|
CString path=ReadLine( fp );
|
||||||
fscanf(fp, "%[^\n]\n", szPath);
|
|
||||||
Course* pCourse = GetCourseFromPath( szPath );
|
Course* pCourse = GetCourseFromPath( path );
|
||||||
if( pCourse == NULL )
|
if( pCourse == NULL )
|
||||||
pCourse = GetCourseFromName( szPath );
|
pCourse = GetCourseFromName( path );
|
||||||
|
|
||||||
for( int i=0; i<NUM_STEPS_TYPES; i++ )
|
for( int i=0; i<NUM_STEPS_TYPES; i++ )
|
||||||
for( int j=0; j<NUM_RANKING_LINES; j++ )
|
for( int j=0; j<NUM_RANKING_LINES; j++ )
|
||||||
|
|||||||
Reference in New Issue
Block a user