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/platform.c b/libpldm/platform.c
index 401e1ca..bc45ae0 100644
--- a/libpldm/platform.c
+++ b/libpldm/platform.c
@@ -649,7 +649,9 @@
return PLDM_SUCCESS;
}
- if (payload_length > PLDM_GET_STATE_SENSOR_READINGS_RESP_BYTES) {
+ if (payload_length >
+ PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES +
+ sizeof(get_sensor_state_field) * *comp_sensor_count) {
return PLDM_ERROR_INVALID_LENGTH;
}