mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-22 03:51:32 +00:00
security fix and highchars fix
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1359 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
3a4d998f6c
commit
ff204ebd02
1 changed files with 19 additions and 2 deletions
|
@ -335,15 +335,26 @@ static void ParseServerinfo(sv_t *tv, netmsg_t *m)
|
|||
|
||||
static void ParsePrint(sv_t *tv, netmsg_t *m, int to, unsigned int mask)
|
||||
{
|
||||
unsigned char *t;
|
||||
char text[1024];
|
||||
int level;
|
||||
|
||||
level = ReadByte(m);
|
||||
ReadString(m, text, sizeof(text));
|
||||
|
||||
if (to == dem_all || to == dem_read)
|
||||
{
|
||||
if (level > 1)
|
||||
{
|
||||
for (t = (unsigned char*)text; *t; t++)
|
||||
{
|
||||
if (*t > 128)
|
||||
*t -= 128;
|
||||
if (*t == 16)
|
||||
*t = '[';
|
||||
}
|
||||
printf("%s", text);
|
||||
}
|
||||
}
|
||||
|
||||
Multicast(tv, m->data+m->startpos, m->readpos - m->startpos, to, mask);
|
||||
|
@ -623,7 +634,10 @@ static void ParseUpdateStat(sv_t *tv, netmsg_t *m, int to, unsigned int mask)
|
|||
statnum = ReadByte(m);
|
||||
value = ReadByte(m);
|
||||
|
||||
for (pnum = 0; pnum < 32; pnum++)
|
||||
if (statnum >= MAX_STATS)
|
||||
statnum = MAX_STATS-1; //please don't crash us
|
||||
|
||||
for (pnum = 0; pnum < MAX_CLIENTS; pnum++)
|
||||
{
|
||||
if (mask & (1<<pnum))
|
||||
tv->players[pnum].stats[statnum] = value;
|
||||
|
@ -640,7 +654,10 @@ static void ParseUpdateStatLong(sv_t *tv, netmsg_t *m, int to, unsigned int mask
|
|||
statnum = ReadByte(m);
|
||||
value = ReadLong(m);
|
||||
|
||||
for (pnum = 0; pnum < 32; pnum++)
|
||||
if (statnum >= MAX_STATS)
|
||||
statnum = MAX_STATS-1; //please don't crash us
|
||||
|
||||
for (pnum = 0; pnum < MAX_CLIENTS; pnum++)
|
||||
{
|
||||
if (mask & (1<<pnum))
|
||||
tv->players[pnum].stats[statnum] = value;
|
||||
|
|
Loading…
Reference in a new issue