diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-02 19:36:14 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-02 19:36:14 +0200 |
commit | 42dcd534df8b41ba24650c2ab6003303b5ae54ce (patch) | |
tree | 37b6dc369524037e20602e3d4c43fec10e875741 /src/Protocol/ProtocolRecognizer.cpp | |
parent | Added CustomName saving. (diff) | |
parent | Re-added alternate spellings of darkgraywool. (diff) | |
download | cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.gz cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.bz2 cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.lz cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.xz cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.zst cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.zip |
Diffstat (limited to 'src/Protocol/ProtocolRecognizer.cpp')
-rw-r--r-- | src/Protocol/ProtocolRecognizer.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index d9cfc140a..2cd2a935b 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -979,9 +979,18 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema AString ServerAddress; short ServerPort; UInt32 NextState; - m_Buffer.ReadVarUTF8String(ServerAddress); - m_Buffer.ReadBEShort(ServerPort); - m_Buffer.ReadVarInt(NextState); + if (!m_Buffer.ReadVarUTF8String(ServerAddress)) + { + break; + } + if (!m_Buffer.ReadBEShort(ServerPort)) + { + break; + } + if (!m_Buffer.ReadVarInt(NextState)) + { + break; + } m_Buffer.CommitRead(); m_Protocol = new cProtocol172(m_Client, ServerAddress, (UInt16)ServerPort, NextState); return true; @@ -991,9 +1000,18 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema AString ServerAddress; short ServerPort; UInt32 NextState; - m_Buffer.ReadVarUTF8String(ServerAddress); - m_Buffer.ReadBEShort(ServerPort); - m_Buffer.ReadVarInt(NextState); + if (!m_Buffer.ReadVarUTF8String(ServerAddress)) + { + break; + } + if (!m_Buffer.ReadBEShort(ServerPort)) + { + break; + } + if (!m_Buffer.ReadVarInt(NextState)) + { + break; + } m_Buffer.CommitRead(); m_Protocol = new cProtocol176(m_Client, ServerAddress, (UInt16)ServerPort, NextState); return true; |