diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-02 20:03:42 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-02 20:03:42 +0200 |
commit | d3b8100a7b84a465ca52238d459bb10d32940c46 (patch) | |
tree | 2c272ec985b9228ef2e4892aeeabefa54786d215 /src/Protocol/ProtocolRecognizer.cpp | |
parent | Removed SexyMotd link (diff) | |
parent | Re-added alternate spellings of darkgraywool. (diff) | |
download | cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.gz cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.bz2 cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.lz cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.xz cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.zst cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.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 c831da251..8b395230a 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; |