Fix: Check reserved fields in channel cmds request
Check reserved fields in channel cmds request and
return 0xCC, if reserved fields are set
Unit-Test:
1. Verified 0xCC is returned if reserved fields are set
ipmitool raw 0x6 0x40 0x11 0x82 0x81
Change-Id: I4ca18c35d1435c6f9a636eb2c2730e63d8df319b
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/user_channel/channelcommands.cpp b/user_channel/channelcommands.cpp
index fd46837..546adb0 100644
--- a/user_channel/channelcommands.cpp
+++ b/user_channel/channelcommands.cpp
@@ -170,9 +170,9 @@
}
uint8_t chNum = convertCurrentChannelNum(req->chNum);
- if (!isValidChannel(chNum))
+ if (!isValidChannel(chNum) || req->reserved_1 != 0 || req->reserved_2 != 0)
{
- log<level::DEBUG>("Set channel access - Parameter out of range");
+ log<level::DEBUG>("Set channel access - Invalid field in request");
return IPMI_CC_INVALID_FIELD_REQUEST;
}
@@ -275,9 +275,9 @@
}
uint8_t chNum = convertCurrentChannelNum(req->chNum);
- if (!isValidChannel(chNum))
+ if (!isValidChannel(chNum) || req->reserved_1 != 0 || req->reserved_2 != 0)
{
- log<level::DEBUG>("Get channel access - Parameter out of range");
+ log<level::DEBUG>("Get channel access - Invalid field in request");
return IPMI_CC_INVALID_FIELD_REQUEST;
}
@@ -341,9 +341,9 @@
}
uint8_t chNum = convertCurrentChannelNum(req->chNum);
- if (!isValidChannel(chNum))
+ if (!isValidChannel(chNum) || req->reserved_1 != 0)
{
- log<level::DEBUG>("Get channel info - Parameter out of range");
+ log<level::DEBUG>("Get channel info - Invalid field in request");
return IPMI_CC_INVALID_FIELD_REQUEST;
}