The readBuffer now checks if the whole packet has arrived before attempting to parse it.

This commit is contained in:
stiffly
2016-03-03 15:16:42 +01:00
parent ae3cab6cd1
commit a7bff92899
5 changed files with 21 additions and 5 deletions
+5
View File
@@ -92,6 +92,11 @@ int UDPServer::readBuffer()
unsigned int sizeOfPacket = 0;
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
if (sizeOfPacket > m_Socket->available()) {
LOG_WARNING("UDPServer::readBuffer(): We haven't got the whole packet yet.");
return 0;
}
// if the buffer is to small increase the size of it
if (sizeOfPacket > m_BufferSize) {
delete[] m_ReadBuffer;