We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 390b25f commit fe12572Copy full SHA for fe12572
lib/mapi/ext_buffer.cpp
@@ -193,9 +193,7 @@ pack_result EXT_PULL::g_str(std::string *out) try
193
auto len = strnlen(&m_cdata[m_offset], m_data_size - m_offset);
194
if (len + 1 > m_data_size - m_offset)
195
return pack_result::format;
196
- out->resize(len);
197
- /* Copy with, and advance over, NUL */
198
- memcpy(out->data(), &m_udata[m_offset], len + 1);
+ out->assign(reinterpret_cast<const char *>(&m_udata[m_offset]), len);
199
return advance(len + 1);
200
} catch (const std::bad_alloc &) {
201
return pack_result::alloc;
0 commit comments