Coderjoe's fix from newtree. (The other part of the DOS fix.)

Prevent an infinite loop in a fairly rare case, where the infostring is
too full to accept a new name when there is a duplicate name.
This commit is contained in:
Zephaniah E. Hull 2001-05-22 13:30:35 +00:00
parent b264cdd28b
commit 98a8db2f0e

View file

@ -1805,6 +1805,18 @@ SV_ExtractFromUserinfo (client_t *cl)
Info_SetValueForKey (cl->userinfo, "name", newname,
MAX_INFO_STRING);
val = Info_ValueForKey (cl->userinfo, "name");
// If the new name was not set (due to the info string
// being too long), drop the client to prevent an infinite
// loop.
if(strcmp(val, newname)) {
SV_ClientPrintf (cl, PRINT_HIGH,
"Please choose a different name.\n");
Con_Printf("Client %d kicked for invalid name\n", cl->userid);
SV_DropClient (cl);
return;
}
} else
break;
}