aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-09-06 17:41:40 +0200
committersapier <Sapier at GMX dot net>2014-09-06 17:42:34 +0200
commit944e79d7a6bc9b80210e12f9e96ea37c37703910 (patch)
treef76f42b3d0124ff914a51ff945adbc704525d59e /src
parent8948907431b329074f98f380c1f4be4bee0b2e3c (diff)
downloadminetest-944e79d7a6bc9b80210e12f9e96ea37c37703910.tar.gz
minetest-944e79d7a6bc9b80210e12f9e96ea37c37703910.tar.bz2
minetest-944e79d7a6bc9b80210e12f9e96ea37c37703910.zip
Fix access to invalid data on reception of packet with size 0
Diffstat (limited to 'src')
-rw-r--r--src/connection.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index 2f9339e6a..bd0d872ca 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -2143,7 +2143,9 @@ void ConnectionReceiveThread::receive()
LOG(derr_con<<m_connection->getDesc()
<<"Receive(): Invalid incoming packet, "
<<"size: " << received_size
- <<", protocol: " << readU32(&packetdata[0]) <<std::endl);
+ <<", protocol: "
+ << ((received_size >= 4) ? readU32(&packetdata[0]) : -1)
+ << std::endl);
continue;
}