mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
SmallString: Fix possible non-null-termination in set_size()
This commit is contained in:
parent
437430cbc4
commit
1caf45cf62
@ -893,6 +893,11 @@ void SmallStringBase::set_size(u32 new_size, bool shrink_if_smaller /*= false*/)
|
|||||||
{
|
{
|
||||||
DebugAssert(new_size <= m_buffer_size);
|
DebugAssert(new_size <= m_buffer_size);
|
||||||
m_length = new_size;
|
m_length = new_size;
|
||||||
|
#if _DEBUG
|
||||||
|
std::memset(m_buffer + new_size, 0, m_buffer_size - new_size);
|
||||||
|
#else
|
||||||
|
m_buffer[new_size] = 0;
|
||||||
|
#endif
|
||||||
if (shrink_if_smaller)
|
if (shrink_if_smaller)
|
||||||
shrink_to_fit();
|
shrink_to_fit();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user