diff options
author | nOOb3167 <nOOb3167@gmail.com> | 2017-12-22 11:33:46 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2017-12-22 10:39:25 +0000 |
commit | 7354d0f3d8ea2d48a85479426bf0c055ff4926b4 (patch) | |
tree | 955fc5bb2be26c3528447c1a88017c52a2f577c4 /src/network | |
parent | 257626ceedc986de822eac5f9708e505b41ec87d (diff) | |
download | minetest-7354d0f3d8ea2d48a85479426bf0c055ff4926b4.tar.gz minetest-7354d0f3d8ea2d48a85479426bf0c055ff4926b4.tar.bz2 minetest-7354d0f3d8ea2d48a85479426bf0c055ff4926b4.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/network')
-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 14b1ac440..530f0fe70 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -63,7 +63,7 @@ void NetworkPacket::putRawPacket(u8 *data, u32 datasize, session_t 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) |