Fixed ChatPrintf and CenterPrintf safety

This commit is contained in:
WPMGPRoSToTeMa 2017-01-25 21:28:20 +03:00
commit 7b27754858
2 changed files with 3 additions and 2 deletions

View file

@ -173,6 +173,7 @@ typedef struct hudtextparms_s
#define VEC_DUCK_VIEW Vector( 0, 0, 12 ) #define VEC_DUCK_VIEW Vector( 0, 0, 12 )
#define SVC_TEMPENTITY 23 #define SVC_TEMPENTITY 23
#define SVC_CENTERPRINT 26
#define SVC_INTERMISSION 30 #define SVC_INTERMISSION 30
#define SVC_CDTRACK 32 #define SVC_CDTRACK 32
#define SVC_WEAPONANIM 35 #define SVC_WEAPONANIM 35

View file

@ -81,6 +81,7 @@ void Engine::ChatPrintf (const char *fmt, ...)
MESSAGE_BEGIN (MSG_BROADCAST, FindMessageId (NETMSG_TEXTMSG)); MESSAGE_BEGIN (MSG_BROADCAST, FindMessageId (NETMSG_TEXTMSG));
WRITE_BYTE (HUD_PRINTTALK); WRITE_BYTE (HUD_PRINTTALK);
WRITE_STRING ("%s");
WRITE_STRING (string); WRITE_STRING (string);
MESSAGE_END (); MESSAGE_END ();
} }
@ -101,8 +102,7 @@ void Engine::CenterPrintf (const char *fmt, ...)
} }
strcat (string, "\n"); strcat (string, "\n");
MESSAGE_BEGIN (MSG_BROADCAST, FindMessageId (NETMSG_TEXTMSG)); MESSAGE_BEGIN (MSG_BROADCAST, SVC_CENTERPRINT);
WRITE_BYTE (HUD_PRINTCENTER);
WRITE_STRING (string); WRITE_STRING (string);
MESSAGE_END (); MESSAGE_END ();
} }