summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--process.cpp6
-rw-r--r--test/process_unittest.cpp6
2 files changed, 7 insertions, 5 deletions
diff --git a/process.cpp b/process.cpp
index 683bf77..a73f70e 100644
--- a/process.cpp
+++ b/process.cpp
@@ -128,8 +128,10 @@ ipmi_ret_t processBlobCommand(IpmiBlobHandler cmd, ManagerInterface* mgr,
return result;
}
- /* The response, if it has one byte, has three, to include the crc16. */
- if (replyLength < (sizeof(uint16_t) + 1))
+ /* Read can return 0 bytes, and just a CRC, otherwise you need a CRC and 1
+ * byte, therefore the limit is 2 bytes.
+ */
+ if (replyLength < (sizeof(uint16_t)))
{
return IPMI_CC_UNSPECIFIED_ERROR;
}
diff --git a/test/process_unittest.cpp b/test/process_unittest.cpp
index a908ee6..0f683e5 100644
--- a/test/process_unittest.cpp
+++ b/test/process_unittest.cpp
@@ -250,8 +250,8 @@ TEST(ProcessBlobCommandTest, CommandReturnsOkWithNoPayload)
TEST(ProcessBlobCommandTest, CommandReturnsOkWithInvalidPayloadLength)
{
- // There is a minimum payload length of 3 bytes, this command returns a
- // payload of 2 bytes.
+ // There is a minimum payload length of 2 bytes (the CRC only, no data, for
+ // read), this returns 1.
StrictMock<CrcMock> crc;
StrictMock<ManagerMock> manager;
@@ -261,7 +261,7 @@ TEST(ProcessBlobCommandTest, CommandReturnsOkWithInvalidPayloadLength)
IpmiBlobHandler h = [](ManagerInterface* mgr, const uint8_t* reqBuf,
uint8_t* replyCmdBuf, size_t* dataLen) {
- (*dataLen) = sizeof(uint16_t);
+ (*dataLen) = sizeof(uint8_t);
return IPMI_CC_OK;
};
OpenPOWER on IntegriCloud