Use strncpy instead of strcpy because again, buffer overflows

This commit is contained in:
Glenn Smith 2018-03-06 01:59:05 -05:00
parent 7769da9434
commit 79c34c68db
92 changed files with 298 additions and 279 deletions

View file

@ -142,7 +142,7 @@ void AppVertConnectorGLSL::sortVars()
void AppVertConnectorGLSL::setName( char *newName )
{
dStrcpy( (char*)mName, newName );
dStrcpy( (char*)mName, newName, 32 );
}
void AppVertConnectorGLSL::reset()
@ -287,7 +287,7 @@ void VertPixelConnectorGLSL::sortVars()
void VertPixelConnectorGLSL::setName( char *newName )
{
dStrcpy( (char*)mName, newName );
dStrcpy( (char*)mName, newName, 32 );
}
void VertPixelConnectorGLSL::reset()

View file

@ -87,7 +87,7 @@ U32 Var::texUnitCount = 0;
Var::Var()
{
dStrcpy( (char*)type, "float4" );
dStrcpy( (char*)type, "float4", 32 );
structName[0] = '\0';
connectName[0] = '\0';
constSortPos = cspUninit;
@ -209,4 +209,4 @@ void MultiLine::print( Stream &stream )
{
mStatementList[i]->print( stream );
}
}
}

View file

@ -153,8 +153,8 @@ void ShaderGen::generateShader( const MaterialFeatureData &featureData,
dSprintf( vertShaderName, sizeof(vertShaderName), "shadergen:/%s_V.%s", cacheName, mFileEnding.c_str() );
dSprintf( pixShaderName, sizeof(pixShaderName), "shadergen:/%s_P.%s", cacheName, mFileEnding.c_str() );
dStrcpy( vertFile, vertShaderName );
dStrcpy( pixFile, pixShaderName );
dStrcpy( vertFile, vertShaderName, 256 );
dStrcpy( pixFile, pixShaderName, 256 );
// this needs to change - need to optimize down to ps v.1.1
*pixVersion = GFX->getPixelShaderVersion();