Handle buffer overflow.
This commit is contained in:
@@ -176,7 +176,6 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
|
|||||||
{
|
{
|
||||||
m_Materials.resize( nNumMaterials );
|
m_Materials.resize( nNumMaterials );
|
||||||
|
|
||||||
// XXX: handle buffer overflow
|
|
||||||
char szName[256];
|
char szName[256];
|
||||||
|
|
||||||
for( int i = 0; i < nNumMaterials; i++ )
|
for( int i = 0; i < nNumMaterials; i++ )
|
||||||
@@ -186,8 +185,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
|
|||||||
// name
|
// name
|
||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
THROW;
|
THROW;
|
||||||
// XXX: handle buffer overflow
|
if( sscanf(sLine, "\"%256[^\"]\"", szName) != 1 )
|
||||||
if( sscanf(sLine, "\"%[^\"]\"", szName) != 1 )
|
|
||||||
THROW;
|
THROW;
|
||||||
Material.sName = szName;
|
Material.sName = szName;
|
||||||
|
|
||||||
@@ -243,7 +241,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
|
|||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
THROW;
|
THROW;
|
||||||
strcpy( szName, "" );
|
strcpy( szName, "" );
|
||||||
sscanf( sLine, "\"%[^\"]\"", szName );
|
sscanf( sLine, "\"%256[^\"]\"", szName );
|
||||||
RString sDiffuseTexture = szName;
|
RString sDiffuseTexture = szName;
|
||||||
|
|
||||||
if( sDiffuseTexture == "" )
|
if( sDiffuseTexture == "" )
|
||||||
@@ -270,7 +268,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
|
|||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
THROW;
|
THROW;
|
||||||
strcpy( szName, "" );
|
strcpy( szName, "" );
|
||||||
sscanf( sLine, "\"%[^\"]\"", szName );
|
sscanf( sLine, "\"%256[^\"]\"", szName );
|
||||||
RString sAlphaTexture = szName;
|
RString sAlphaTexture = szName;
|
||||||
|
|
||||||
if( sAlphaTexture == "" )
|
if( sAlphaTexture == "" )
|
||||||
|
|||||||
Reference in New Issue
Block a user