Prevent technically unsafe access with empty vector
authorgregorycu <gregory.currie@gmail.com>
Sun, 3 Jan 2016 07:25:09 +0000 (18:25 +1100)
committerLoic Blot <loic.blot@unix-experience.fr>
Sun, 3 Jan 2016 14:37:49 +0000 (15:37 +0100)
src/network/networkpacket.cpp

index b5e451cdb0a0512146828952ce3b06f543dcf1ac..2b308f334e2f94211cd9e86d36bd833d9917724d 100644 (file)
@@ -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;
 }