libpldm: fix the length bytes of get state sensor readings resp
Since the len of stateFields is variable(0x01-0x08), we only define
the min len for the get state sensor readings resp.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I105042a3c45e3b0a96b701c556e22579b56c1c03
diff --git a/libpldm/tests/libpldm_platform_test.cpp b/libpldm/tests/libpldm_platform_test.cpp
index 992d74a..b30bc66 100644
--- a/libpldm/tests/libpldm_platform_test.cpp
+++ b/libpldm/tests/libpldm_platform_test.cpp
@@ -550,7 +550,9 @@
TEST(GetStateSensorReadings, testGoodEncodeResponse)
{
- std::array<uint8_t, hdrSize + PLDM_GET_STATE_SENSOR_READINGS_RESP_BYTES>
+ std::array<uint8_t, hdrSize +
+ PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES +
+ sizeof(get_sensor_state_field) * 2>
responseMsg{};
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
@@ -593,7 +595,9 @@
TEST(GetStateSensorReadings, testGoodDecodeResponse)
{
- std::array<uint8_t, hdrSize + PLDM_GET_STATE_SENSOR_READINGS_RESP_BYTES>
+ std::array<uint8_t, hdrSize +
+ PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES +
+ sizeof(get_sensor_state_field) * 2>
responseMsg{};
uint8_t completionCode = 0;
@@ -638,7 +642,9 @@
TEST(GetStateSensorReadings, testBadDecodeResponse)
{
- std::array<uint8_t, hdrSize + PLDM_GET_STATE_SENSOR_READINGS_RESP_BYTES>
+ std::array<uint8_t, hdrSize +
+ PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES +
+ sizeof(get_sensor_state_field) * 2>
responseMsg{};
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());