Fix SecBlock Append() overload

This commit is contained in:
Jeffrey Walton 2021-04-09 01:40:24 -04:00
parent 191e08c838
commit d6799a6984
No known key found for this signature in database
GPG Key ID: B36AB348921B1838

View File

@ -948,7 +948,6 @@ public:
if (len)
{
const size_type oldSize = m_size;
Grow(m_size+len);
if (m_ptr && ptr) // GCC analyzer warning
memcpy_s(m_ptr+oldSize, (m_size-oldSize)*sizeof(T), ptr, len*sizeof(T));
@ -1003,8 +1002,9 @@ public:
if (ELEMS_MAX - m_size < count)
throw InvalidArgument("Append: buffer overflow");
const size_type oldSize = m_size;
Grow(m_size+count);
for (size_t i=m_size; i<m_size+count; ++i)
for (size_t i=oldSize; i<oldSize+count; ++i)
m_ptr[i] = value;
m_mark = ELEMS_MAX;