platform-mc: Fix sensor aux name pdr parsing
This fixes an issue with counting the null terminator twice:
both on the name length and on the pdr pointer increment.
This caused to_bytes to throw an exception on sensors with composite
sensor count larger than 1.
Change-Id: I85c2c12854698402b213fe2dd66a42ac8c299902
Signed-off-by: tal-yac <talycb8@gmail.com>
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
diff --git a/platform-mc/terminus.cpp b/platform-mc/terminus.cpp
index 5b2ab3c..004158a 100644
--- a/platform-mc/terminus.cpp
+++ b/platform-mc/terminus.cpp
@@ -283,8 +283,7 @@
}
memcpy(alignedBuffer, ptr, u16NameStringLen * sizeof(uint16_t));
std::u16string u16NameString(alignedBuffer, u16NameStringLen);
- ptr += (u16NameString.size() + sizeof(nullTerminator)) *
- sizeof(uint16_t);
+ ptr += u16NameString.size() * sizeof(uint16_t);
std::transform(u16NameString.cbegin(), u16NameString.cend(),
u16NameString.begin(),
[](uint16_t utf16) { return be16toh(utf16); });