diff options
author | madmaxoft <github@xoft.cz> | 2014-08-12 11:10:32 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-08-12 11:10:32 +0200 |
commit | 3020e8cc05a0732ee880ab16bbab66e4e9b72dd7 (patch) | |
tree | b373615f2008cee45301ac1756d18396c161ae05 /src/Protocol | |
parent | Fixed unchecked return values. (diff) | |
parent | Merge pull request #1316 from ChriPiv/master (diff) | |
download | cuberite-3020e8cc05a0732ee880ab16bbab66e4e9b72dd7.tar cuberite-3020e8cc05a0732ee880ab16bbab66e4e9b72dd7.tar.gz cuberite-3020e8cc05a0732ee880ab16bbab66e4e9b72dd7.tar.bz2 cuberite-3020e8cc05a0732ee880ab16bbab66e4e9b72dd7.tar.lz cuberite-3020e8cc05a0732ee880ab16bbab66e4e9b72dd7.tar.xz cuberite-3020e8cc05a0732ee880ab16bbab66e4e9b72dd7.tar.zst cuberite-3020e8cc05a0732ee880ab16bbab66e4e9b72dd7.zip |
Diffstat (limited to 'src/Protocol')
-rw-r--r-- | src/Protocol/Protocol125.h | 2 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h index 18efeb079..3adac3055 100644 --- a/src/Protocol/Protocol125.h +++ b/src/Protocol/Protocol125.h @@ -103,7 +103,7 @@ public: protected: /// Results of packet-parsing: - enum + enum eParseResult { PARSE_OK = 1, PARSE_ERROR = -1, diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 318342f09..1f8ca00bb 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -48,7 +48,10 @@ Implements the 1.7.x protocol classes: #define HANDLE_READ(ByteBuf, Proc, Type, Var) \ Type Var; \ - ByteBuf.Proc(Var); + if (!ByteBuf.Proc(Var))\ + {\ + return;\ + } @@ -1700,8 +1703,7 @@ bool cProtocol172::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) void cProtocol172::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer) { - Int64 Timestamp; - a_ByteBuffer.ReadBEInt64(Timestamp); + HANDLE_READ(a_ByteBuffer, ReadBEInt64, Int64, Timestamp); cPacketizer Pkt(*this, 0x01); // Ping packet Pkt.WriteInt64(Timestamp); @@ -2054,7 +2056,10 @@ void cProtocol172::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel); HANDLE_READ(a_ByteBuffer, ReadBEShort, short, Length); AString Data; - a_ByteBuffer.ReadString(Data, Length); + if (!a_ByteBuffer.ReadString(Data, Length)) + { + return; + } m_Client->HandlePluginMessage(Channel, Data); } |