Browse Source

More safe strncat usage.

fix-cwd-path
Andrey Akhmichin 2 years ago
parent
commit
cea0903626
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
  1. 3
      cl_dll/MOTD.cpp
  2. 1
      cl_dll/death.cpp

3
cl_dll/MOTD.cpp

@ -134,7 +134,8 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );
int is_finished = READ_BYTE(); 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 ) if( is_finished )
{ {

1
cl_dll/death.cpp

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

Loading…
Cancel
Save