From 5471d2cd2f527a6f7981c218dfe0b12edda611e0 Mon Sep 17 00:00:00 2001
From: "se.gorbunov" <se.gorbunov@gsi.de>
Date: Sun, 22 Oct 2023 16:54:46 +0000
Subject: [PATCH] bugfix in rich unpacker

---
 .../mcbm2018/unpacker/CbmMcbm2018UnpackerUtilRich2020.cxx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerUtilRich2020.cxx b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerUtilRich2020.cxx
index 2819887d43..04bc65cf76 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);
 
-- 
GitLab