mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-27 07:15:37 +03:00
Adjust TextMsg/SayText maximum buffer length from 190 to 187 due to "%s" parameter added in #763
This commit is contained in:
parent
d819df80f9
commit
4f6b779bf4
@ -260,15 +260,15 @@ void UTIL_DHudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const c
|
|||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* warning - buffer of msg must be longer than 190 chars!
|
/* warning - buffer of msg must be longer than 187 chars!
|
||||||
(here in AMX it is always longer) */
|
(here in AMX it is always longer) */
|
||||||
void UTIL_ClientPrint(edict_t *pEntity, int msg_dest, char *msg)
|
void UTIL_ClientPrint(edict_t *pEntity, int msg_dest, char *msg)
|
||||||
{
|
{
|
||||||
if (!gmsgTextMsg)
|
if (!gmsgTextMsg)
|
||||||
return; // :TODO: Maybe output a warning log?
|
return; // :TODO: Maybe output a warning log?
|
||||||
|
|
||||||
char c = msg[190];
|
char c = msg[187];
|
||||||
msg[190] = 0; // truncate without checking with strlen()
|
msg[187] = 0; // truncate without checking with strlen()
|
||||||
|
|
||||||
if (pEntity)
|
if (pEntity)
|
||||||
MESSAGE_BEGIN(MSG_ONE, gmsgTextMsg, NULL, pEntity);
|
MESSAGE_BEGIN(MSG_ONE, gmsgTextMsg, NULL, pEntity);
|
||||||
@ -279,7 +279,7 @@ void UTIL_ClientPrint(edict_t *pEntity, int msg_dest, char *msg)
|
|||||||
WRITE_STRING("%s");
|
WRITE_STRING("%s");
|
||||||
WRITE_STRING(msg);
|
WRITE_STRING(msg);
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
msg[190] = c;
|
msg[187] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UTIL_ClientSayText(edict_t *pEntity, int sender, char *msg)
|
void UTIL_ClientSayText(edict_t *pEntity, int sender, char *msg)
|
||||||
@ -287,15 +287,15 @@ void UTIL_ClientSayText(edict_t *pEntity, int sender, char *msg)
|
|||||||
if (!gmsgSayText)
|
if (!gmsgSayText)
|
||||||
return; // :TODO: Maybe output a warning log?
|
return; // :TODO: Maybe output a warning log?
|
||||||
|
|
||||||
char c = msg[190];
|
char c = msg[187];
|
||||||
msg[190] = 0; // truncate without checking with strlen()
|
msg[187] = 0; // truncate without checking with strlen()
|
||||||
|
|
||||||
MESSAGE_BEGIN(MSG_ONE, gmsgSayText, NULL, pEntity);
|
MESSAGE_BEGIN(MSG_ONE, gmsgSayText, NULL, pEntity);
|
||||||
WRITE_BYTE(sender);
|
WRITE_BYTE(sender);
|
||||||
WRITE_STRING("%s");
|
WRITE_STRING("%s");
|
||||||
WRITE_STRING(msg);
|
WRITE_STRING(msg);
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
msg[190] = c;
|
msg[187] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UTIL_TeamInfo(edict_t *pEntity, int playerIndex, const char *pszTeamName)
|
void UTIL_TeamInfo(edict_t *pEntity, int playerIndex, const char *pszTeamName)
|
||||||
|
Loading…
Reference in New Issue
Block a user