(svn r1389) -Add: [Network] Added packet protection. No longer a client or server

reads beyond the size of the packet
-Fix: [Network] A server no longer crashes when a client sends an 
invalid DoCommand, but drops the client instead.
This commit is contained in:
truelight
2005-01-05 14:39:48 +00:00
parent 9545f8c19c
commit 503ccc81c9
8 changed files with 213 additions and 116 deletions

View File

@@ -482,7 +482,10 @@ void NetworkCloseClient(NetworkClientState *cs)
{
NetworkClientInfo *ci;
// Socket is already dead
if (cs->socket == INVALID_SOCKET) return;
if (cs->socket == INVALID_SOCKET) {
cs->quited = true;
return;
}
DEBUG(net, 1) ("[NET] Closed client connection");
@@ -509,6 +512,7 @@ void NetworkCloseClient(NetworkClientState *cs)
closesocket(cs->socket);
cs->writable = false;
cs->quited = true;
// Free all pending and partially received packets
while (cs->packet_queue != NULL) {