aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgregorycu <gregory.currie@gmail.com>2016-01-03 18:25:09 +1100
committerLoic Blot <loic.blot@unix-experience.fr>2016-01-03 15:37:49 +0100
commit87dcee6ac2058bbf5264ea7f82874bba67277252 (patch)
treeb4a9a20f0de72d0af79fe3af505a84bde2cd09aa
parenta7c50a3080e55a6cf11175a60121696de7393dba (diff)
downloadminetest-87dcee6ac2058bbf5264ea7f82874bba67277252.tar.gz
minetest-87dcee6ac2058bbf5264ea7f82874bba67277252.tar.bz2
minetest-87dcee6ac2058bbf5264ea7f82874bba67277252.zip
Prevent technically unsafe access with empty vector
-rw-r--r--src/network/networkpacket.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp
index b5e451cdb..2b308f334 100644
--- a/src/network/networkpacket.cpp
+++ b/src/network/networkpacket.cpp
@@ -77,6 +77,9 @@ void NetworkPacket::putRawString(const char* src, u32 len)
m_data.resize(m_datasize);
}
+ if (m_datasize == 0)
+ return;
+
memcpy(&m_data[m_read_offset], src, len);
m_read_offset += len;
}