mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
clean up Cvar_Info, removing redundant code and a potential overflow
This commit is contained in:
parent
2630ed1adf
commit
a9dbdb5b9b
1 changed files with 2 additions and 24 deletions
|
@ -839,34 +839,12 @@ SV_SendServerInfoChange (const char *key, const char *value)
|
|||
MSG_WriteString (&sv.reliable_datagram, value);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Cvar_Info
|
||||
|
||||
Sets a given cvar (key,value) into svs.info (serverinfo)
|
||||
high char filtering is performed according to sv_highchars.value
|
||||
|
||||
*/
|
||||
void
|
||||
Cvar_Info (cvar_t *var)
|
||||
{
|
||||
if (var->flags & CVAR_SERVERINFO) {
|
||||
unsigned char info[1024], *p;
|
||||
const unsigned char *c;
|
||||
|
||||
if (!sv_highchars || !sv_highchars->int_val) {
|
||||
for (p = info, c = var->string;
|
||||
*c && (p - info < (int) sizeof (info) - 1);) {
|
||||
if ((*c & 0x7f) >= 32)
|
||||
*p++ = *c & 0x7f;
|
||||
c++;
|
||||
}
|
||||
*p = 0;
|
||||
Info_SetValueForKey (svs.info, var->name, info,
|
||||
(sv_highchars && !sv_highchars->int_val));
|
||||
} else
|
||||
Info_SetValueForKey (svs.info, var->name, var->string,
|
||||
(sv_highchars && !sv_highchars->int_val));
|
||||
Info_SetValueForKey (svs.info, var->name, var->string,
|
||||
(!sv_highchars || !sv_highchars->int_val));
|
||||
|
||||
SV_SendServerInfoChange (var->name, var->string);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue