bugfix: tools: fixup the region copied
Fixup the region copied in the blob handler so that the CRC is run
across the correct bytes.
Change-Id: Ie4bc8323b072e19f525110bbd68c46d3734ea3b8
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/tools/blob_handler.cpp b/tools/blob_handler.cpp
index a181559..43fc891 100644
--- a/tools/blob_handler.cpp
+++ b/tools/blob_handler.cpp
@@ -92,9 +92,14 @@
auto ptr = reinterpret_cast<std::uint8_t*>(&crc);
std::memcpy(ptr, &reply[ipmiPhosphorOen.size()], sizeof(crc));
+ for (const auto& byte : reply)
+ {
+ std::fprintf(stderr, "0x%02x ", byte);
+ }
+ std::fprintf(stderr, "\n");
+
std::vector<std::uint8_t> bytes;
- std::copy(&reply[headerSize], &reply[reply.size()],
- std::back_inserter(bytes));
+ bytes.insert(bytes.begin(), reply.begin() + headerSize, reply.end());
auto computed = generateCrc(bytes);
if (crc != computed)