Don't use memcpy to terminate string.

This commit is contained in:
Bartosz Taudul 2018-03-19 15:41:28 +01:00
parent 2b54bd1b15
commit 05eb4b7ebc

View File

@ -1114,7 +1114,8 @@ StringLocation Worker::StoreString( char* str, size_t sz )
if( sit == m_data.stringMap.end() ) if( sit == m_data.stringMap.end() )
{ {
auto ptr = m_slab.Alloc<char>( sz+1 ); auto ptr = m_slab.Alloc<char>( sz+1 );
memcpy( ptr, str, sz+1 ); memcpy( ptr, str, sz );
ptr[sz] = '\0';
ret.ptr = ptr; ret.ptr = ptr;
ret.idx = m_data.stringData.size(); ret.idx = m_data.stringData.size();
m_data.stringMap.emplace( ptr, m_data.stringData.size() ); m_data.stringMap.emplace( ptr, m_data.stringData.size() );