From 7b27754858ccb2ec8fd720ed32b9c2c9ccda3abb Mon Sep 17 00:00:00 2001 From: WPMGPRoSToTeMa Date: Wed, 25 Jan 2017 21:28:20 +0300 Subject: [PATCH] Fixed ChatPrintf and CenterPrintf safety --- include/engine/util.h | 1 + source/engine.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/engine/util.h b/include/engine/util.h index 6618254..e0a387d 100644 --- a/include/engine/util.h +++ b/include/engine/util.h @@ -173,6 +173,7 @@ typedef struct hudtextparms_s #define VEC_DUCK_VIEW Vector( 0, 0, 12 ) #define SVC_TEMPENTITY 23 +#define SVC_CENTERPRINT 26 #define SVC_INTERMISSION 30 #define SVC_CDTRACK 32 #define SVC_WEAPONANIM 35 diff --git a/source/engine.cpp b/source/engine.cpp index c6bb169..71a6435 100644 --- a/source/engine.cpp +++ b/source/engine.cpp @@ -81,6 +81,7 @@ void Engine::ChatPrintf (const char *fmt, ...) MESSAGE_BEGIN (MSG_BROADCAST, FindMessageId (NETMSG_TEXTMSG)); WRITE_BYTE (HUD_PRINTTALK); + WRITE_STRING ("%s"); WRITE_STRING (string); MESSAGE_END (); } @@ -101,8 +102,7 @@ void Engine::CenterPrintf (const char *fmt, ...) } strcat (string, "\n"); - MESSAGE_BEGIN (MSG_BROADCAST, FindMessageId (NETMSG_TEXTMSG)); - WRITE_BYTE (HUD_PRINTCENTER); + MESSAGE_BEGIN (MSG_BROADCAST, SVC_CENTERPRINT); WRITE_STRING (string); MESSAGE_END (); }