From 7354d0f3d8ea2d48a85479426bf0c055ff4926b4 Mon Sep 17 00:00:00 2001 From: nOOb3167 Date: Fri, 22 Dec 2017 11:33:46 +0100 Subject: [PATCH] Fix undefined behaviour on getting pointer to data in empty vector `&vector[0]` is undefined if vector.empty(), causing build failure on MSVC --- src/network/networkpacket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)