Fix for not allow out-of-bounds read in IPMI chnl

Issue: As IPMI channel number assignment starts from 0 to 15, user can
access channel numbers from 0-15 only. If user tried to access IPMI
channel number 16, not throwing out of range error message to the user.
From channel number 17 onwards only throwing out of range error message
to the user.

Fix: Added check to throw out of range error message to the user,
when tried to access channel number equal to or greater than 16.

Tested: Verified using ipmitool raw commands by hacking channel number
to 16 (as IPMI channel_number parameter size is only 4-bits for most of
the IPMI commands) and verified error message.

Signed-off-by: Meera-Katta <meerax.katta@linux.intel.com>
Change-Id: Iac3d8e66bd8cfbbb67aa403f3e19ae18347ea03b
diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index a1a9051..5f44818 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -352,7 +352,7 @@
 
 bool ChannelConfig::isValidChannel(const uint8_t chNum)
 {
-    if (chNum > maxIpmiChannels)
+    if (chNum >= maxIpmiChannels)
     {
         log<level::DEBUG>("Invalid channel ID - Out of range");
         return false;
@@ -1022,7 +1022,7 @@
         {
             std::string chKey = it.key();
             uint8_t chNum = std::stoi(chKey, nullptr, 10);
-            if ((chNum < 0) || (chNum > maxIpmiChannels))
+            if (chNum >= maxIpmiChannels)
             {
                 log<level::DEBUG>(
                     "Invalid channel access entry in config file");
@@ -1090,7 +1090,7 @@
         {
             std::string chKey = it.key();
             uint8_t chNum = std::stoi(chKey, nullptr, 10);
-            if ((chNum < 0) || (chNum > maxIpmiChannels))
+            if (chNum >= maxIpmiChannels)
             {
                 log<level::DEBUG>(
                     "Invalid channel access entry in config file");