diff options
author | Sumanth Bhat <sumanth.bhat@intel.com> | 2019-03-07 11:51:53 +0530 |
---|---|---|
committer | Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com> | 2019-03-25 02:00:03 +0000 |
commit | b9631f8edf351990ed19f8708ded88be6d24c31b (patch) | |
tree | c6e22661f4345a5e52dc5c2c9b65d2eb171c4b28 | |
parent | 716d1efebef016a2bb1099d12e5b72e941063a58 (diff) | |
download | phosphor-net-ipmid-b9631f8edf351990ed19f8708ded88be6d24c31b.tar.gz phosphor-net-ipmid-b9631f8edf351990ed19f8708ded88be6d24c31b.zip |
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>
-rw-r--r-- | command/payload_cmds.cpp | 6 | ||||
-rw-r--r-- | command/payload_cmds.hpp | 1 |
2 files changed, 7 insertions, 0 deletions
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 @@ std::vector<uint8_t> deactivatePayload(const std::vector<uint8_t>& inPayload, 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 @@ struct DeactivatePayloadRequest 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 |