From b9631f8edf351990ed19f8708ded88be6d24c31b Mon Sep 17 00:00:00 2001 From: Sumanth Bhat Date: Thu, 7 Mar 2019 11:51:53 +0530 Subject: 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 Signed-off-by: Richard Marian Thomaiyar --- command/payload_cmds.cpp | 6 ++++++ command/payload_cmds.hpp | 1 + 2 files changed, 7 insertions(+) (limited to 'command') 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 deactivatePayload(const std::vector& 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(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 -- cgit v1.2.3