summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2014-09-01 19:18:07 +0200
committerworktycho <work.tycho@gmail.com>2014-09-01 19:18:07 +0200
commitde30a8c8c6fac58a137a9d1faf80acc64c04050c (patch)
treee1a01d960ac3b36bc03ec380f52c28a05b4f9828
parentFixed style. (diff)
downloadcuberite-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 '')
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp30
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;