summaryrefslogtreecommitdiffstats
path: root/src/Protocol/ProtocolRecognizer.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-02 20:11:38 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-02 20:11:38 +0200
commite431bb4e63b03a4137e4264beccfab0fffea6e36 (patch)
treee5442606b9e5be82070dc733b6162a76ed89ac87 /src/Protocol/ProtocolRecognizer.cpp
parentChanged the IsEnchantable() comment. (diff)
parentRe-added alternate spellings of darkgraywool. (diff)
downloadcuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar
cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.gz
cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.bz2
cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.lz
cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.xz
cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.tar.zst
cuberite-e431bb4e63b03a4137e4264beccfab0fffea6e36.zip
Diffstat (limited to 'src/Protocol/ProtocolRecognizer.cpp')
-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;