summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol17x.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2015-03-09 22:39:11 +0100
committerHowaner <franzi.moos@googlemail.com>2015-03-09 22:39:11 +0100
commita96c21fc0d4326ffda93cc78c5dfcfc4bd034e24 (patch)
tree38dba8f86163283d90d1d6d9d2fa420cb4e99231 /src/Protocol/Protocol17x.cpp
parentReadded old comment (diff)
parentFixed client kick/crash if many block changes happend (diff)
downloadcuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.gz
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.bz2
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.lz
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.xz
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.zst
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.zip
Diffstat (limited to 'src/Protocol/Protocol17x.cpp')
-rw-r--r--src/Protocol/Protocol17x.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 169367949..f78c2e54b 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -679,8 +679,8 @@ void cProtocol172::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decor
for (cMapDecoratorList::const_iterator it = a_Decorators.begin(); it != a_Decorators.end(); ++it)
{
- ASSERT((it->GetPixelX() >= 0) && (it->GetPixelX() < 256));
- ASSERT((it->GetPixelZ() >= 0) && (it->GetPixelZ() < 256));
+ ASSERT(it->GetPixelX() < 256);
+ ASSERT(it->GetPixelZ() < 256);
Pkt.WriteByte(static_cast<Byte>((it->GetType() << 4) | static_cast<Byte>(it->GetRot() & 0xf)));
Pkt.WriteByte(static_cast<Byte>(it->GetPixelX()));
Pkt.WriteByte(static_cast<Byte>(it->GetPixelZ()));
@@ -694,7 +694,7 @@ void cProtocol172::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decor
void cProtocol172::SendMapInfo(int a_ID, unsigned int a_Scale)
{
ASSERT(m_State == 3); // In game mode?
- ASSERT((a_Scale >= 0) && (a_Scale < 256));
+ ASSERT(a_Scale < 256);
cPacketizer Pkt(*this, 0x34);
Pkt.WriteVarInt(static_cast<UInt32>(a_ID));
@@ -1757,7 +1757,10 @@ void cProtocol172::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
void cProtocol172::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffer)
{
short EncKeyLength, EncNonceLength;
- a_ByteBuffer.ReadBEShort(EncKeyLength);
+ if (!a_ByteBuffer.ReadBEShort(EncKeyLength))
+ {
+ return;
+ }
if ((EncKeyLength < 0) || (EncKeyLength > MAX_ENC_LEN))
{
LOGD("Invalid Encryption Key length: %d. Kicking client.", EncKeyLength);