Skip to content
Snippets Groups Projects
Commit 5471d2cd authored by Sergey Gorbunov's avatar Sergey Gorbunov Committed by Sergey Gorbunov
Browse files

bugfix in rich unpacker

parent a3d6cd98
No related branches found
No related tags found
1 merge request!1402bugfix in rich unpacker
Pipeline #24826 passed
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment