pldmtool: Fix missing range begin
Iterating through the composite effecter count
could result in a seg fault
Tested:
```
root@bmc:~# pldmtool platform GetStateEffecterStates -m 9 -i 1323 -v
pldmtool: Tx: 80 02 3a 2b 05
pldmtool: Rx: 00 02 3a 00 08 01 00 01 01 00 01 01 00 01 01 00 01 01 00 01 01 00 01 01 00 01 01 00 01
{
"compositeEffecterCount": 8,
"effecterOpState[0])": "Effecter Enabled No Update Pending",
"pendingState[0]": 0,
"presentState[0]": 1,
"effecterOpState[1])": "Effecter Enabled No Update Pending",
"pendingState[1]": 0,
"presentState[1]": 1,
"effecterOpState[2])": "Effecter Enabled No Update Pending",
"pendingState[2]": 0,
"presentState[2]": 1,
"effecterOpState[3])": "Effecter Enabled No Update Pending",
"pendingState[3]": 0,
"presentState[3]": 1,
"effecterOpState[4])": "Effecter Enabled No Update Pending",
"pendingState[4]": 0,
"presentState[4]": 1,
"effecterOpState[5])": "Effecter Enabled No Update Pending",
"pendingState[5]": 0,
"presentState[5]": 1,
"effecterOpState[6])": "Effecter Enabled No Update Pending",
"pendingState[6]": 0,
"presentState[6]": 1,
"effecterOpState[7])": "Effecter Enabled No Update Pending",
"pendingState[7]": 0,
"presentState[7]": 1
}
```
Change-Id: I9c0f211478e30cda601fe163b4bbeaf3878dbecc
Signed-off-by: Tal Yacobi <talycb8@gmail.com>
diff --git a/pldmtool/pldm_platform_cmd.cpp b/pldmtool/pldm_platform_cmd.cpp
index 0f3ca25..b952534 100644
--- a/pldmtool/pldm_platform_cmd.cpp
+++ b/pldmtool/pldm_platform_cmd.cpp
@@ -2079,7 +2079,7 @@
auto comp_effecter_count = static_cast<int>(resp.comp_effecter_count);
output["compositeEffecterCount"] = comp_effecter_count;
- for (auto i : std::views::iota(comp_effecter_count))
+ for (auto i : std::views::iota(0, comp_effecter_count))
{
output[std::format("effecterOpState[{}])", i)] =
getEffecterOpState(resp.field[i].effecter_op_state);