Fix decode getStateSensorReadings resp command

Logically, first parse the response data and verify the validity of
the comp_sensor_count value, and then verify whether the length of
the response data is correct.

Tested: Used raw commond and test passed.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I9369474e44891088efc46dcdc3194d88cc13f35f
diff --git a/libpldm/tests/libpldm_platform_test.cpp b/libpldm/tests/libpldm_platform_test.cpp
index b30bc66..49b08f6 100644
--- a/libpldm/tests/libpldm_platform_test.cpp
+++ b/libpldm/tests/libpldm_platform_test.cpp
@@ -610,7 +610,7 @@
                      PLDM_SENSOR_LOWERCRITICAL, PLDM_SENSOR_WARNING};
 
     uint8_t retcompletion_code = 0;
-    uint8_t retcomp_sensorCnt = 2;
+    uint8_t retcomp_sensorCnt = 0;
     std::array<get_sensor_state_field, 2> retstateField{};
 
     auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
@@ -675,7 +675,7 @@
            (sizeof(get_sensor_state_field) * comp_sensorCnt));
 
     rc = decode_get_state_sensor_readings_resp(
-        response, responseMsg.size() - hdrSize, &retcompletion_code,
+        response, responseMsg.size() - hdrSize + 1, &retcompletion_code,
         &retcomp_sensorCnt, retstateField.data());
 
     EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);