biosConfigCommands: Add check for invalid paramSel
Add additional check in Get Payload IPMI
command for parameter selection. Check
that it's a valid parameter.
Tested: When parameter selection is set above max
we're returning the expected error code 0xcc
instead of 0xff.
Change-Id: I77f94a164fb9f05a7d17ad558a9afb91b762b6c8
Signed-off-by: Matt Simmering <matthew.simmering@intel.com>
diff --git a/src/biosconfigcommands.cpp b/src/biosconfigcommands.cpp
index 805306e..83b8959 100644
--- a/src/biosconfigcommands.cpp
+++ b/src/biosconfigcommands.cpp
@@ -105,7 +105,8 @@
{
GetPayloadInfo = 0, // 0
GetPayloadData = 1, // 1
- GetPayloadStatus = 2
+ GetPayloadStatus = 2,
+ MaxPayloadParameters
};
namespace payload1
@@ -927,6 +928,12 @@
// 1-OOB BIOS config is supported
message::Payload retValue;
+ if (static_cast<GetPayloadParameter>(paramSel) >=
+ ipmi::GetPayloadParameter::MaxPayloadParameters)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+
if (!(gNVOOBdata.mBIOSCapabilities.OOBCapability & (biosCapOffsetBit)))
{
return ipmi::response(ipmiCCBIOSCapabilityInitNotDone);