From: havoc Date: Mon, 23 May 2005 22:29:14 +0000 (+0000) Subject: NetConn_ReceivedMessage now verifies that the packet's internal length value matches... X-Git-Tag: xonotic-v0.1.0preview~4857 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6da5ed6a526ed1005fe2113478a33b238feca5aa;p=xonotic%2Fdarkplaces.git NetConn_ReceivedMessage now verifies that the packet's internal length value matches the data length git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5324 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/netconn.c b/netconn.c index 6f96f28b..97ad13cc 100755 --- a/netconn.c +++ b/netconn.c @@ -763,14 +763,15 @@ int NetConn_ReceivedMessage(netconn_t *conn, qbyte *data, int length) unsigned int count; unsigned int flags; unsigned int sequence; + int qlength; - length = BigLong(((int *)data)[0]); - flags = length & ~NETFLAG_LENGTH_MASK; - length &= NETFLAG_LENGTH_MASK; - if (length >= 8) + if (length >= 8) { + qlength = (unsigned int)BigLong(((int *)data)[0]); + flags = qlength & ~NETFLAG_LENGTH_MASK; + qlength &= NETFLAG_LENGTH_MASK; // control packets were already handled - if (!(flags & NETFLAG_CTL)) + if (!(flags & NETFLAG_CTL) && qlength == length) { sequence = BigLong(((int *)data)[1]); packetsReceived++; @@ -852,7 +853,7 @@ int NetConn_ReceivedMessage(netconn_t *conn, qbyte *data, int length) "Dropping the message!\n", sequence ); conn->receiveMessageLength = 0; return 1; - } + } if (flags & NETFLAG_EOM) { reliableMessagesReceived++;