This commit is contained in:
Christoph Oelckers 2014-01-12 10:53:34 +01:00
commit 725d3e3f53

View file

@ -293,7 +293,7 @@ void PacketGet (void)
return; return;
} }
} }
else if (c > 0) else if (node >= 0 && c > 0)
{ {
doomcom.data[0] = TransmitBuffer[0] & ~NCMD_COMPRESSED; doomcom.data[0] = TransmitBuffer[0] & ~NCMD_COMPRESSED;
if (TransmitBuffer[0] & NCMD_COMPRESSED) if (TransmitBuffer[0] & NCMD_COMPRESSED)
@ -316,6 +316,12 @@ void PacketGet (void)
memcpy(doomcom.data + 1, TransmitBuffer + 1, c - 1); memcpy(doomcom.data + 1, TransmitBuffer + 1, c - 1);
} }
} }
else if (c > 0)
{ //The packet is not from any in-game node, so we might as well discard it.
Printf("Dropped packet: Unknown host (%s:%d)\n", inet_ntoa(fromaddress.sin_addr), fromaddress.sin_port);
doomcom.remotenode = -1;
return;
}
doomcom.remotenode = node; doomcom.remotenode = node;
doomcom.datalength = (short)c; doomcom.datalength = (short)c;