mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-30 12:40:42 +00:00
- consider ':' and '"' to be special characters in names, just in case
- make sure to update the infostrings if they tried changing a name and it was the same after sanitizing
This commit is contained in:
parent
388c3a78ee
commit
c79294f57d
1 changed files with 12 additions and 3 deletions
|
@ -2203,6 +2203,14 @@ SV_ExtractFromUserinfo (client_t *cl)
|
||||||
if (!*newname)
|
if (!*newname)
|
||||||
badname = true;
|
badname = true;
|
||||||
|
|
||||||
|
// ':' is used in chat messages
|
||||||
|
if (strchr (newname, ':'))
|
||||||
|
badname = true;
|
||||||
|
|
||||||
|
// I dunno if this is possible, but better safe than sorry
|
||||||
|
if (strchr (newname, '"'))
|
||||||
|
badname = true;
|
||||||
|
|
||||||
// impersonating an user-xxx name. if they're using it
|
// impersonating an user-xxx name. if they're using it
|
||||||
// legitimately it'll be a no-op later on
|
// legitimately it'll be a no-op later on
|
||||||
if (!strncasecmp (newname, "user-", 5))
|
if (!strncasecmp (newname, "user-", 5))
|
||||||
|
@ -2227,7 +2235,7 @@ SV_ExtractFromUserinfo (client_t *cl)
|
||||||
snprintf (newname, sizeof (newname), "user-%d", cl->userid);
|
snprintf (newname, sizeof (newname), "user-%d", cl->userid);
|
||||||
|
|
||||||
// set the name
|
// set the name
|
||||||
if (strcmp (cl->name, newname)) {
|
if (strcmp (newname, val) || strcmp (cl->name, newname)) {
|
||||||
Info_SetValueForKey (cl->userinfo, "name", newname, MAX_INFO_STRING,
|
Info_SetValueForKey (cl->userinfo, "name", newname, MAX_INFO_STRING,
|
||||||
!sv_highchars->int_val);
|
!sv_highchars->int_val);
|
||||||
val = Info_ValueForKey (cl->userinfo, "name");
|
val = Info_ValueForKey (cl->userinfo, "name");
|
||||||
|
@ -2261,9 +2269,10 @@ SV_ExtractFromUserinfo (client_t *cl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// finally, report it to all our friends
|
// finally, report it to all our friends, but only if more
|
||||||
|
// than whitespace changed
|
||||||
// if (cl->state >= cs_spawned && !cl->spectator)
|
// if (cl->state >= cs_spawned && !cl->spectator)
|
||||||
if (*cl->name)
|
if (*cl->name && strcmp (cl->name, newname))
|
||||||
SV_BroadcastPrintf (PRINT_HIGH, "%s changed name to %s\n",
|
SV_BroadcastPrintf (PRINT_HIGH, "%s changed name to %s\n",
|
||||||
cl->name, newname);
|
cl->name, newname);
|
||||||
strcpy (cl->name, newname);
|
strcpy (cl->name, newname);
|
||||||
|
|
Loading…
Reference in a new issue