Use the NetworkPacket api to read full version string instead of u8 pointers. Also...
authorLoic Blot <loic.blot@unix-experience.fr>
Tue, 17 Mar 2015 13:04:46 +0000 (14:04 +0100)
committerLoic Blot <loic.blot@unix-experience.fr>
Tue, 17 Mar 2015 13:12:18 +0000 (14:12 +0100)
Fixes #2509

src/network/serverpackethandler.cpp

index bb3a5346345265bb17d4f3b60a9af005b3fb0a9b..fd3b0ac0e6543b34e28c40516cf66decfba7bb98 100644 (file)
@@ -732,7 +732,7 @@ void Server::handleCommand_ClientReady(NetworkPacket* pkt)
        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;
+                       << "disconnecting peer_id: " << peer_id << std::endl;
                m_con.DisconnectPeer(peer_id);
                return;
        }
@@ -756,12 +756,13 @@ void Server::handleCommand_ClientReady(NetworkPacket* pkt)
                return;
        }
 
-       u8 major_ver, minor_ver, patch_ver;
-       *pkt >> major_ver >> minor_ver >> patch_ver;
+       u8 major_ver, minor_ver, patch_ver, reserved;
+       std::string full_ver;
+       *pkt >> major_ver >> minor_ver >> patch_ver >> reserved >> full_ver;
 
        m_clients.setClientVersion(
                        peer_id, major_ver, minor_ver, patch_ver,
-                       std::string(pkt->getString(6),(u16) pkt->getU8(4)));
+                       full_ver);
 
        m_clients.event(peer_id, CSE_SetClientReady);
        m_script->on_joinplayer(playersao);