Attempts to prevent stupid stuff from happening

This commit is contained in:
Monster Iestyn 2017-05-19 11:25:28 +01:00
parent b564c8ab9a
commit 5a1fc6098e
2 changed files with 14 additions and 2 deletions

View file

@ -3936,6 +3936,9 @@ FILESTAMP
while (HGetPacket())
{
if (doomcom->remotenode == -1) // ...this should have been ignored already
continue; // might come from PT_NODETIMEOUT somehow though
node = (SINT8)doomcom->remotenode;
if (netbuffer->packettype == PT_CLIENTJOIN && server)
@ -3968,8 +3971,10 @@ FILESTAMP
if (netbuffer->packettype == PT_PLAYERINFO)
continue; // We do nothing with PLAYERINFO, that's for the MS browser.
if (node < 0 || node >= MAXNETNODES) // THIS SHOULDN'T EVEN BE POSSIBLE
; //CONS_Printf("Received packet from node %d!\n", (int)node);
// Packet received from someone already playing
if (nodeingame[node])
else if (nodeingame[node])
HandlePacketFromPlayer(node);
// Packet received from someone not playing
else

View file

@ -711,6 +711,10 @@ void Net_CloseConnection(INT32 node)
#else
INT32 i;
boolean forceclose = (node & FORCECLOSE) != 0;
if (node == -1)
return; // nope, just ignore it
node &= ~FORCECLOSE;
if (!node)
@ -718,7 +722,7 @@ void Net_CloseConnection(INT32 node)
if (node < 0 || node >= MAXNETNODES) // prevent invalid nodes from crashing the game
{
CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node);
//CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node);
return;
}
@ -1128,6 +1132,9 @@ boolean HGetPacket(void)
doomcom->remotenode = 0;
rebound_tail = (rebound_tail+1) % MAXREBOUND;
if (doomcom->remotenode == -1) // wait hang on what?
return true; // there might still be packets from others though, so don't return false
#ifdef DEBUGFILE
if (debugfile)
DebugPrintpacket("GETLOCAL");