diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerUtilRich2020.cxx b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerUtilRich2020.cxx index 2819887d431864de8b9f6162c5dd5243d2c6cee8..04bc65cf76bb4bbb3f988cf1049768e48ee601a7 100644 --- a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerUtilRich2020.cxx +++ b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerUtilRich2020.cxx @@ -20,7 +20,7 @@ std::string mRichSupport::GetBinaryRepresentation(size_t const size, uint8_t con for (int i = size - 1; i >= 0; i--) { for (int j = 7; j >= 0; j--) { byte = (b[i] >> j) & 1; - snprintf(cStr, buf_size - 1, "%u", byte); + snprintf(cStr, buf_size, "%u", byte); outString.append(cStr); } } @@ -44,7 +44,7 @@ std::string mRichSupport::GetHexRepresentation(size_t const size, uint8_t const* for (int i = size - 1; i >= 0; i--) { byte = b[i] & 0xff; - snprintf(cStr, buf_size - 1, "%02x", byte); + snprintf(cStr, buf_size, "%02x", byte); outString.append(cStr); } @@ -66,7 +66,7 @@ std::string mRichSupport::GetWordHexRepr(uint8_t const* const ptr) char cStr[buf_size]; cStr[9] = '\0'; - snprintf(cStr, buf_size - 1, "%02x%02x %02x%02x", byte[0], byte[1], byte[2], byte[3]); + snprintf(cStr, buf_size, "%02x%02x %02x%02x", byte[0], byte[1], byte[2], byte[3]); outString.append(cStr); @@ -88,7 +88,7 @@ std::string mRichSupport::GetWordHexReprInv(uint8_t const* const ptr) char cStr[buf_size]; cStr[9] = '\0'; - snprintf(cStr, buf_size - 1, "%02x%02x %02x%02x", byte[0], byte[1], byte[2], byte[3]); + snprintf(cStr, buf_size, "%02x%02x %02x%02x", byte[0], byte[1], byte[2], byte[3]); outString.append(cStr);