Prevent technically unsafe access with empty vector

experimental
gregorycu 2016-01-03 18:25:09 +11:00 committed by Loic Blot
parent a7c50a3080
commit 87dcee6ac2
1 changed files with 3 additions and 0 deletions

View File

@ -77,6 +77,9 @@ void NetworkPacket::putRawString(const char* src, u32 len)
m_data.resize(m_datasize); m_data.resize(m_datasize);
} }
if (m_datasize == 0)
return;
memcpy(&m_data[m_read_offset], src, len); memcpy(&m_data[m_read_offset], src, len);
m_read_offset += len; m_read_offset += len;
} }