Handle invalid length for Disable Payload command
Invalid length error check added for disable payload command
Tested:
1. Verified negative case by providing improper length
ipmitool -I lanplus -H x.x.x.x -U root -P 0penBmc raw 6 0x49 0x11 0x01
0x00 0x00 0x00 0x00 0x00 0x00
2. Verified normal case works fine.
Change-Id: I1d0dfcadb2dbaf4f538597fbff236540127a3667
Signed-off-by: Sumanth Bhat <sumanth.bhat@intel.com>
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp
index 3b5b4f8..c32a510 100644
--- a/command/payload_cmds.cpp
+++ b/command/payload_cmds.cpp
@@ -101,6 +101,12 @@
response->completionCode = IPMI_CC_OK;
+ if (inPayload.size() != sizeof(DeactivatePayloadRequest))
+ {
+ response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
+ return outPayload;
+ }
+
// SOL is the payload currently supported for deactivation
if (static_cast<uint8_t>(message::PayloadType::SOL) != request->payloadType)
{
diff --git a/command/payload_cmds.hpp b/command/payload_cmds.hpp
index f916c11..b28392b 100644
--- a/command/payload_cmds.hpp
+++ b/command/payload_cmds.hpp
@@ -144,6 +144,7 @@
uint8_t auxData1; //!< Auxiliary data 1
uint8_t auxData2; //!< Auxiliary data 2
uint8_t auxData3; //!< Auxiliary data 3
+ uint8_t auxData4; //!< Auxiliary data 4
} __attribute__((packed));
/** @struct DeactivatePayloadResponse