Closed
Description
Hi,
The following method is copying a string to a SBE message buffer but the padding is not working for a string length less than 20. The loop that adds the padding (this part: start < length) needs to use the buffer size not the srcLength, no?
SBEOrderResponseMsg &putSymbol(const std::string& str)
{
const size_t srcLength = str.length();
if (srcLength > 20)
{
throw std::runtime_error("string too large for putSymbol [E106]");
}
size_t length = srcLength < 20 ? srcLength : 20;
std::memcpy(m_buffer + m_offset + 25, str.c_str(), length);
for (size_t start = srcLength; start < **length**; ++start)
{
m_buffer[m_offset + 25 + start] = 0;
}
return *this;
}