Fix server assert in case of invalid message from client, just kick that client.
authorsapier <Sapier at GMX dot net>
Sat, 21 Jun 2014 21:56:46 +0000 (23:56 +0200)
committersapier <Sapier at GMX dot net>
Sat, 21 Jun 2014 21:56:46 +0000 (23:56 +0200)
src/server.cpp

index 29fb18112004b0533413f4e183f3202f7f670c61..7c4c48c48f352dacf8de98cb78033dfc15867d73 100644 (file)
@@ -1752,7 +1752,13 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
        else if(command == TOSERVER_CLIENT_READY) {
                // clients <= protocol version 22 did not send ready message,
                // they're already initialized
-               assert(peer_proto_ver > 22);
+               if (peer_proto_ver <= 22) {
+                       infostream << "Client sent message not expected by a "
+                               << "client using protocol version <= 22,"
+                               << "disconnecing peer_id: " << peer_id << std::endl;
+                       m_con.DisconnectPeer(peer_id);
+                       return;
+               }
 
                PlayerSAO* playersao = StageTwoClientInit(peer_id);