From 7e3b59305300a878bf1d676c4d749fa3050130df Mon Sep 17 00:00:00 2001 From: x86 <126331+x86@users.noreply.github.com> Date: Sun, 8 Mar 2026 13:10:17 +1300 Subject: [PATCH] Rce Fix 3 --- Minecraft.World/TexturePacket.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Minecraft.World/TexturePacket.cpp b/Minecraft.World/TexturePacket.cpp index 77dfdc38c..a057c7173 100644 --- a/Minecraft.World/TexturePacket.cpp +++ b/Minecraft.World/TexturePacket.cpp @@ -37,16 +37,24 @@ void TexturePacket::handle(PacketListener *listener) void TexturePacket::read(DataInputStream *dis) //throws IOException { textureName = dis->readUTF(); - dwBytes = (DWORD)dis->readShort(); - - if(dwBytes>0) + short rawBytes = dis->readShort(); + if(rawBytes <= 0) { - this->pbData= new BYTE [dwBytes]; + dwBytes = 0; + return; + } + dwBytes = (DWORD)(unsigned short)rawBytes; + if(dwBytes > 65536) + { + dwBytes = 0; + return; + } + + this->pbData= new BYTE [dwBytes]; - for(DWORD i=0;ipbData[i] = dis->readByte(); - } + for(DWORD i=0;ipbData[i] = dis->readByte(); } }