mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-23 21:24:27 +00:00
More safe strncpy usage.
This commit is contained in:
parent
9033377e5e
commit
e6424f42a7
@ -263,7 +263,8 @@ ParticleType *ParticleSystem::GetType( const char *szName )
|
|||||||
ParticleType *ParticleSystem::AddPlaceholderType( const char *szName )
|
ParticleType *ParticleSystem::AddPlaceholderType( const char *szName )
|
||||||
{
|
{
|
||||||
m_pFirstType = new ParticleType( m_pFirstType );
|
m_pFirstType = new ParticleType( m_pFirstType );
|
||||||
strncpy(m_pFirstType->m_szName, szName, sizeof(m_pFirstType->m_szName) );
|
strncpy(m_pFirstType->m_szName, szName, sizeof(m_pFirstType->m_szName) - 1);
|
||||||
|
m_pFirstType->m_szName[sizeof(m_pFirstType->m_szName) - 1] = '\0';
|
||||||
return m_pFirstType;
|
return m_pFirstType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,8 +286,8 @@ ParticleType *ParticleSystem::ParseType( char *&szFile )
|
|||||||
if ( !stricmp( szToken, "name" ) )
|
if ( !stricmp( szToken, "name" ) )
|
||||||
{
|
{
|
||||||
szFile = gEngfuncs.COM_ParseFile(szFile,szToken);
|
szFile = gEngfuncs.COM_ParseFile(szFile,szToken);
|
||||||
strncpy(pType->m_szName, szToken, sizeof(pType->m_szName) );
|
strncpy(pType->m_szName, szToken, sizeof(pType->m_szName) - 1 );
|
||||||
|
pType->m_szName[sizeof(pType->m_szName) - 1] = '\0';
|
||||||
ParticleType *pTemp = GetType(szToken);
|
ParticleType *pTemp = GetType(szToken);
|
||||||
if (pTemp)
|
if (pTemp)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user