--- 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<unsigned char*> (HuffmanBuffer), - decodedPacket, length, &decodedLength); + HUFFMAN_Decode (reinterpret_cast<unsigned char*>(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);