diff -r 5900be70c619 -r 9f54db6f9922 sources/network/udpsocket.cpp --- a/sources/network/udpsocket.cpp Sat Jan 09 17:48:45 2016 +0200 +++ b/sources/network/udpsocket.cpp Mon Jan 25 04:15:31 2016 +0200 @@ -129,10 +129,15 @@ return false; } + if (length < 4) + { + m_error = "The server sent a too short packet"; + return false; + } + unsigned char decodedPacket[MAX_DATAGRAM_LENGTH]; int decodedLength = sizeof decodedPacket; - HUFFMAN_Decode (reinterpret_cast (HuffmanBuffer), - decodedPacket, length, &decodedLength); + HUFFMAN_Decode (reinterpret_cast(HuffmanBuffer), decodedPacket, length, &decodedLength); datagram.from.host = ntohl (claddr.sin_addr.s_addr); datagram.from.port = ntohs (claddr.sin_port); datagram.data = Bytestream (decodedPacket, decodedLength);