More safe strncat usage.

This commit is contained in:
Andrey Akhmichin 2022-11-14 08:14:24 +05:00
parent 7cffbef773
commit cea0903626
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
2 changed files with 3 additions and 1 deletions

View File

@ -134,7 +134,8 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
BEGIN_READ( pbuf, iSize );
int is_finished = READ_BYTE();
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) - 1 );
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) - strlen(m_szMOTD) - 1 );
m_szMOTD[sizeof(m_szMOTD) - 1] = '\0';
if( is_finished )
{

View File

@ -173,6 +173,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
char killedwith[32];
strcpy( killedwith, "d_" );
strncat( killedwith, READ_STRING(), sizeof(killedwith) - strlen(killedwith) - 1 );
killedwith[sizeof(killedwith) - 1] = '\0';
#if USE_VGUI
if (gViewPort)