Added VLAN ID checking condition in Set LAN config

According to the VLAN 802.1VLAN spec, VLAN ID should be 1-4095

Unit test:
Verified VLAN ID 1-4095 is allowed  and CC returns for 0 & > 4095

Signed-off-by: Suryakanth Sekar <suryakanth.sekar@linux.intel.com>
Change-Id: I54bbc94c814c98dda11f8241fa31bfe0e5bbb150
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 8795c1a..acff251 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -416,7 +416,6 @@
                                   ipmi_context_t context)
 {
     ipmi_ret_t rc = IPMI_CC_OK;
-    *data_len = 0;
 
     char ipaddr[INET_ADDRSTRLEN];
     char netmask[INET_ADDRSTRLEN];
@@ -425,6 +424,9 @@
     auto reqptr = reinterpret_cast<const set_lan_t*>(request);
     sdbusplus::bus::bus bus(ipmid_get_sd_bus_connection());
 
+    size_t reqLen = *data_len;
+    *data_len = 0;
+
     // channel number is the lower nibble
     int channel = reqptr->channel & CHANNEL_MASK;
     auto ethdevice = ipmi::getChannelName(channel);
@@ -499,12 +501,21 @@
 
         case LanParam::VLAN:
         {
+            if (reqLen != lanParamVLANSize)
+            {
+                return IPMI_CC_REQ_DATA_LEN_INVALID;
+            }
+
             uint16_t vlan{};
             std::memcpy(&vlan, reqptr->data, ipmi::network::VLAN_SIZE_BYTE);
             // We are not storing the enable bit
             // We assume that ipmitool always send enable
             // bit as 1.
             vlan = le16toh(vlan);
+            if (vlan == 0 || vlan > maxValidVLANIDValue)
+            {
+                return IPMI_CC_INVALID_FIELD_REQUEST;
+            }
             channelConf->vlanID = vlan;
         }
         break;