diff options
author | worktycho <work.tycho@gmail.com> | 2014-09-01 19:18:07 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2014-09-01 19:18:07 +0200 |
commit | de30a8c8c6fac58a137a9d1faf80acc64c04050c (patch) | |
tree | e1a01d960ac3b36bc03ec380f52c28a05b4f9828 /src/Protocol | |
parent | Fixed style. (diff) | |
download | cuberite-de30a8c8c6fac58a137a9d1faf80acc64c04050c.tar cuberite-de30a8c8c6fac58a137a9d1faf80acc64c04050c.tar.gz cuberite-de30a8c8c6fac58a137a9d1faf80acc64c04050c.tar.bz2 cuberite-de30a8c8c6fac58a137a9d1faf80acc64c04050c.tar.lz cuberite-de30a8c8c6fac58a137a9d1faf80acc64c04050c.tar.xz cuberite-de30a8c8c6fac58a137a9d1faf80acc64c04050c.tar.zst cuberite-de30a8c8c6fac58a137a9d1faf80acc64c04050c.zip |
Diffstat (limited to 'src/Protocol')
-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; |