From 5385056a9e1e03364f09de603f58ba59d1be494a Mon Sep 17 00:00:00 2001 From: Dabb Date: Mon, 14 Aug 2000 13:41:05 +0000 Subject: [PATCH] Detect runt client packets quicker. --- source/sv_main.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/source/sv_main.c b/source/sv_main.c index 17370f2..061e600 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -206,7 +206,7 @@ void SV_FinalMessage (char *message) { int i; client_t *cl; - + SZ_Clear (&net_message); MSG_WriteByte (&net_message, svc_print); MSG_WriteByte (&net_message, PRINT_HIGH); @@ -1278,10 +1278,10 @@ SV_ReadPackets */ void SV_ReadPackets (void) { - int i; + int i; client_t *cl; qboolean good; - int qport; + int qport; good = false; while (NET_GetPacket ()) @@ -1299,6 +1299,12 @@ void SV_ReadPackets (void) continue; } + if (net_message.cursize < 11) + { + Con_Printf ("%s: Runt packet\n",NET_AdrToString(net_from)); + continue; + } + // read the qport out of the message so we can fix up // stupid address translating routers MSG_BeginReading (); @@ -1333,7 +1339,7 @@ void SV_ReadPackets (void) if (i != MAX_CLIENTS) continue; - + // packet is not from a known client // Con_Printf ("%s:sequenced packet without connection\n" // ,NET_AdrToString(net_from)); @@ -1772,7 +1778,7 @@ void SV_ExtractFromUserinfo (client_t *cl) } else if (cl->lastnamecount++ > 4) { SV_BroadcastPrintf (PRINT_HIGH, "%s was kicked for name spam\n", cl->name); SV_ClientPrintf (cl, PRINT_HIGH, "You were kicked from the game for name spamming\n"); - SV_DropClient (cl); + SV_DropClient (cl); return; } } @@ -1782,7 +1788,7 @@ void SV_ExtractFromUserinfo (client_t *cl) } - strncpy (cl->name, val, sizeof(cl->name)-1); + strncpy (cl->name, val, sizeof(cl->name)-1); // rate command val = Info_ValueForKey (cl->userinfo, "rate"); @@ -1860,7 +1866,7 @@ void SV_Init (quakeparms_t *parms) Sys_Init (); Cbuf_Init (); - Cmd_Init (); + Cmd_Init (); SV_InitOperatorCommands (); // execute +set as early as possible