mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Don't use memcpy to terminate string.
This commit is contained in:
parent
2b54bd1b15
commit
05eb4b7ebc
@ -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() );
|
||||||
|
Loading…
Reference in New Issue
Block a user