From 759729b5a8a41753320f4939493a0cdc56813da9 Mon Sep 17 00:00:00 2001 From: Thad Ward Date: Tue, 22 May 2001 12:55:36 +0000 Subject: [PATCH] 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. --- source/sv_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/sv_main.c b/source/sv_main.c index 005deae..77008eb 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -1758,6 +1758,14 @@ 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; }