diff options
author | nOOb3167 <nOOb3167@gmail.com> | 2017-12-22 11:33:46 +0100 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2018-06-03 17:32:00 +0200 |
commit | bb219e1059b711ba9663ed42304c8c22cacf86ab (patch) | |
tree | c777991c996f0d9d566e519484f4f7fd295a94a4 /src | |
parent | b3167d4e5748ffd14efc5981ba8349c01808b78a (diff) | |
download | minetest-bb219e1059b711ba9663ed42304c8c22cacf86ab.tar.gz minetest-bb219e1059b711ba9663ed42304c8c22cacf86ab.tar.bz2 minetest-bb219e1059b711ba9663ed42304c8c22cacf86ab.zip |
Fix undefined behaviour on getting pointer to data in empty vector
`&vector[0]` is undefined if vector.empty(), causing build failure on MSVC
Diffstat (limited to 'src')
-rw-r--r-- | src/network/networkpacket.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp index 8e06ae104..c4fcf9600 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -62,7 +62,7 @@ void NetworkPacket::putRawPacket(u8 *data, u32 datasize, u16 peer_id) // split command and datas m_command = readU16(&data[0]); - memcpy(&m_data[0], &data[2], m_datasize); + memcpy(m_data.data(), &data[2], m_datasize); } const char* NetworkPacket::getString(u32 from_offset) |