sources/network/udpsocket.cpp

branch
protocol5
changeset 172
0b0bc8045d28
parent 171
d0fba0d7ad03
--- a/sources/network/udpsocket.cpp	Wed Jan 27 12:34:26 2021 +0200
+++ b/sources/network/udpsocket.cpp	Wed Jan 27 12:34:56 2021 +0200
@@ -129,6 +129,12 @@
 		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),

mercurial