Browse Source

Safe _snprintf usage.

hl_urbicide
Andrey Akhmichin 5 years ago
parent
commit
6af5c3f472
  1. 4
      cl_dll/text_message.cpp

4
cl_dll/text_message.cpp

@ -182,19 +182,23 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf @@ -182,19 +182,23 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
{
case HUD_PRINTCENTER:
_snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
psz[MSG_BUF_SIZE - 1] = '\0';
CenterPrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTNOTIFY:
psz[0] = 1; // mark this message to go into the notify buffer
_snprintf( psz + 1, MSG_BUF_SIZE - 1, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
psz[MSG_BUF_SIZE - 2] = '\0';
ConsolePrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTTALK:
_snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
psz[MSG_BUF_SIZE - 1] = '\0';
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE );
break;
case HUD_PRINTCONSOLE:
_snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
psz[MSG_BUF_SIZE - 1] = '\0';
ConsolePrint( ConvertCRtoNL( psz ) );
break;
}

Loading…
Cancel
Save