mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-24 18:59:26 +01:00
More safe _snprintf usage.
This commit is contained in:
parent
cea0903626
commit
368fdf1259
@ -109,7 +109,10 @@ void ClientDisconnect( edict_t *pEntity )
|
|||||||
|
|
||||||
char text[256] = "";
|
char text[256] = "";
|
||||||
if( pEntity->v.netname )
|
if( pEntity->v.netname )
|
||||||
_snprintf( text, sizeof(text), "- %s has left the game\n", STRING( pEntity->v.netname ) );
|
{
|
||||||
|
_snprintf( text, sizeof(text) - 1, "- %s has left the game\n", STRING( pEntity->v.netname ) );
|
||||||
|
text[sizeof(text) - 1] = '\0';
|
||||||
|
}
|
||||||
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
||||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||||
WRITE_STRING( text );
|
WRITE_STRING( text );
|
||||||
@ -667,7 +670,8 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
|
|||||||
if( gpGlobals->maxClients > 1 )
|
if( gpGlobals->maxClients > 1 )
|
||||||
{
|
{
|
||||||
char text[256];
|
char text[256];
|
||||||
_snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
|
_snprintf( text, sizeof(text) - 1, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
|
||||||
|
text[sizeof(text) - 1] = '\0';
|
||||||
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
||||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||||
WRITE_STRING( text );
|
WRITE_STRING( text );
|
||||||
|
Loading…
Reference in New Issue
Block a user