dsp: platform: Bounds check encode_state_effecter_pdr()
```
../src/dsp/platform.c:84:9: error: use of attacker-controlled value ‘possible_states_size’ as size without upper-bounds checking [CWE-129] [-Werror=analyzer-tainted-size]
84 | memcpy(effecter->possible_states, possible_states,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85 | possible_states_size);
| ~~~~~~~~~~~~~~~~~~~~~
```
Fixes: 9c76679224cf ("libpldm: Migrate to subproject")
Change-Id: I7a53144c4c02639a0f7b7291277d8903d8f2717e
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index caeee60..54abcd9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -47,6 +47,7 @@
- `decode_platform_event_message_resp()`
- `decode_sensor_op_data()`
- `encode_get_state_effecter_states_resp()`
+ - `encode_state_effecter_pdr()`
- `encode_state_sensor_pdr()`
- `pldm_pdr_find_record()`
- `pldm_pdr_get_next_record()`
@@ -115,6 +116,7 @@
4. dsp: platform: Prevent overflow of arithmetic on event_data_length
5. dsp: platform: Bounds check encode_sensor_state_pdr()
+6. dsp: platform: Bounds check encode_state_effecter_pdr()
## [0.9.1] - 2024-09-07
diff --git a/abi/x86_64/gcc.dump b/abi/x86_64/gcc.dump
index 6b47967..a67b416 100644
--- a/abi/x86_64/gcc.dump
+++ b/abi/x86_64/gcc.dump
@@ -7045,13 +7045,13 @@
},
'4' => {
'name' => 'field',
- 'type' => '195752'
+ 'type' => '195755'
}
},
'Return' => '100',
'ShortName' => 'decode_set_state_effecter_states_req'
},
- '195757' => {
+ '195760' => {
'Header' => 'platform.h',
'Line' => '1718',
'Param' => {
@@ -7076,7 +7076,7 @@
'Return' => '100',
'ShortName' => 'decode_set_state_effecter_states_resp'
},
- '195832' => {
+ '195835' => {
'Header' => 'platform.h',
'Line' => '1699',
'Param' => {
@@ -7094,7 +7094,7 @@
},
'3' => {
'name' => 'field',
- 'type' => '195752'
+ 'type' => '195755'
},
'4' => {
'name' => 'msg',
@@ -7107,7 +7107,7 @@
'Return' => '100',
'ShortName' => 'encode_set_state_effecter_states_req'
},
- '196176' => {
+ '196179' => {
'Header' => 'platform.h',
'Line' => '1331',
'Param' => {
@@ -7127,13 +7127,13 @@
'Return' => '100',
'ShortName' => 'encode_set_state_effecter_states_resp'
},
- '196343' => {
+ '196346' => {
'Header' => 'platform.h',
'Line' => '681',
'Param' => {
'0' => {
'name' => 'sensor',
- 'type' => '196733'
+ 'type' => '196736'
},
'1' => {
'name' => 'allocation_size',
@@ -7141,7 +7141,7 @@
},
'2' => {
'name' => 'possible_states',
- 'type' => '196743'
+ 'type' => '196746'
},
'3' => {
'name' => 'possible_states_size',
@@ -7162,13 +7162,13 @@
'Return' => '100',
'ShortName' => 'encode_state_sensor_pdr'
},
- '196753' => {
+ '196756' => {
'Header' => 'platform.h',
'Line' => '921',
'Param' => {
'0' => {
'name' => 'effecter',
- 'type' => '197138'
+ 'type' => '196926'
},
'1' => {
'name' => 'allocation_size',
@@ -7176,7 +7176,7 @@
},
'2' => {
'name' => 'possible_states',
- 'type' => '197148'
+ 'type' => '196936'
},
'3' => {
'name' => 'possible_states_size',
@@ -7189,21 +7189,21 @@
},
'Reg' => {
'0' => 'rdi',
- '1' => 'r10',
- '2' => 'rsi',
- '3' => 'r9',
+ '1' => 'rsi',
+ '2' => 'rdx',
+ '3' => 'rcx',
'4' => 'r8'
},
'Return' => '100',
'ShortName' => 'encode_state_effecter_pdr'
},
- '200583' => {
+ '200371' => {
'Header' => 'instance-id.h',
'Line' => '85',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '200763'
+ 'type' => '200551'
},
'1' => {
'name' => 'tid',
@@ -7217,13 +7217,13 @@
'Return' => '100',
'ShortName' => 'pldm_instance_id_free'
},
- '200768' => {
+ '200556' => {
'Header' => 'instance-id.h',
'Line' => '68',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '200763'
+ 'type' => '200551'
},
'1' => {
'name' => 'tid',
@@ -7231,19 +7231,19 @@
},
'2' => {
'name' => 'iid',
- 'type' => '201150'
+ 'type' => '200938'
}
},
'Return' => '100',
'ShortName' => 'pldm_instance_id_alloc'
},
- '201155' => {
+ '200943' => {
'Header' => 'instance-id.h',
'Line' => '51',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '200763'
+ 'type' => '200551'
}
},
'Reg' => {
@@ -7252,25 +7252,25 @@
'Return' => '100',
'ShortName' => 'pldm_instance_db_destroy'
},
- '201240' => {
+ '201028' => {
'Header' => 'instance-id.h',
'Line' => '41',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '201326'
+ 'type' => '201114'
}
},
'Return' => '100',
'ShortName' => 'pldm_instance_db_init_default'
},
- '201331' => {
+ '201119' => {
'Header' => 'instance-id.h',
'Line' => '28',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '201326'
+ 'type' => '201114'
},
'1' => {
'name' => 'dbpath',
@@ -7280,13 +7280,13 @@
'Return' => '100',
'ShortName' => 'pldm_instance_db_init'
},
- '202282' => {
+ '202070' => {
'Header' => 'transport.h',
'Line' => '53',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '202319'
+ 'type' => '202107'
},
'1' => {
'name' => 'tid',
@@ -7307,16 +7307,16 @@
'2' => 'rdx',
'3' => 'rcx'
},
- 'Return' => '202233',
+ 'Return' => '202021',
'ShortName' => 'pldm_transport_send_msg'
},
- '202329' => {
+ '202117' => {
'Header' => 'transport.h',
'Line' => '118',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '202319'
+ 'type' => '202107'
},
'1' => {
'name' => 'tid',
@@ -7342,16 +7342,16 @@
'Reg' => {
'2' => 'r14'
},
- 'Return' => '202233',
+ 'Return' => '202021',
'ShortName' => 'pldm_transport_send_recv_msg'
},
- '202386' => {
+ '202174' => {
'Header' => 'mctp-demux.h',
'Line' => '18',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '202277'
+ 'type' => '202065'
}
},
'Reg' => {
@@ -7360,17 +7360,17 @@
'Return' => '1',
'ShortName' => 'pldm_transport_mctp_demux_destroy'
},
- '202423' => {
+ '202211' => {
'Header' => 'transport.h',
'Line' => '81',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '202319'
+ 'type' => '202107'
},
'1' => {
'name' => 'tid',
- 'type' => '202460'
+ 'type' => '202248'
},
'2' => {
'name' => 'pldm_msg',
@@ -7387,16 +7387,16 @@
'2' => 'rbp',
'3' => 'rcx'
},
- 'Return' => '202233',
+ 'Return' => '202021',
'ShortName' => 'pldm_transport_recv_msg'
},
- '202465' => {
+ '202253' => {
'Header' => 'mctp-demux.h',
'Line' => '32',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '202277'
+ 'type' => '202065'
},
'1' => {
'name' => 'tid',
@@ -7404,7 +7404,7 @@
},
'2' => {
'name' => 'eid',
- 'type' => '202118'
+ 'type' => '201906'
}
},
'Reg' => {
@@ -7415,28 +7415,28 @@
'Return' => '100',
'ShortName' => 'pldm_transport_mctp_demux_map_tid'
},
- '202497' => {
+ '202285' => {
'Header' => 'mctp-demux.h',
'Line' => '22',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '202277'
+ 'type' => '202065'
}
},
'Reg' => {
'0' => 'rdi'
},
- 'Return' => '202319',
+ 'Return' => '202107',
'ShortName' => 'pldm_transport_mctp_demux_core'
},
- '202541' => {
+ '202329' => {
'Header' => 'mctp-demux.h',
'Line' => '15',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '202563'
+ 'type' => '202351'
}
},
'Reg' => {
@@ -7445,19 +7445,19 @@
'Return' => '100',
'ShortName' => 'pldm_transport_mctp_demux_init'
},
- '202622' => {
+ '202410' => {
'Header' => 'pldm.h',
'Line' => '119',
'Return' => '1',
'ShortName' => 'pldm_close'
},
- '202666' => {
+ '202454' => {
'Header' => 'pldm.h',
'Line' => '75',
'Param' => {
'0' => {
'name' => 'eid',
- 'type' => '202118'
+ 'type' => '201906'
},
'1' => {
'name' => 'mctp_fd',
@@ -7478,16 +7478,16 @@
'2' => 'rdx',
'3' => 'rcx'
},
- 'Return' => '202233',
+ 'Return' => '202021',
'ShortName' => 'pldm_send'
},
- '203085' => {
+ '202873' => {
'Header' => 'pldm.h',
'Line' => '57',
'Param' => {
'0' => {
'name' => 'eid',
- 'type' => '202118'
+ 'type' => '201906'
},
'1' => {
'name' => 'mctp_fd',
@@ -7518,16 +7518,16 @@
'4' => 'r8',
'5' => 'r9'
},
- 'Return' => '202233',
+ 'Return' => '202021',
'ShortName' => 'pldm_send_recv'
},
- '203568' => {
+ '203356' => {
'Header' => 'pldm.h',
'Line' => '94',
'Param' => {
'0' => {
'name' => 'eid',
- 'type' => '202118'
+ 'type' => '201906'
},
'1' => {
'name' => 'mctp_fd',
@@ -7549,16 +7549,16 @@
'Reg' => {
'3' => 'rbx'
},
- 'Return' => '202233',
+ 'Return' => '202021',
'ShortName' => 'pldm_recv'
},
- '203794' => {
+ '203582' => {
'Header' => 'pldm.h',
'Line' => '112',
'Param' => {
'0' => {
'name' => 'eid',
- 'type' => '202118'
+ 'type' => '201906'
},
'1' => {
'name' => 'mctp_fd',
@@ -7577,26 +7577,26 @@
'2' => 'r12',
'3' => 'r13'
},
- 'Return' => '202233',
+ 'Return' => '202021',
'ShortName' => 'pldm_recv_any'
},
- '204247' => {
+ '204035' => {
'Header' => 'pldm.h',
'Line' => '39',
- 'Return' => '202233',
+ 'Return' => '202021',
'ShortName' => 'pldm_open'
},
- '206665' => {
+ '206453' => {
'Header' => 'af-mctp.h',
'Line' => '54',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '206821'
+ 'type' => '206609'
},
'1' => {
'name' => 'smctp',
- 'type' => '206826'
+ 'type' => '206614'
},
'2' => {
'name' => 'len',
@@ -7610,13 +7610,13 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_bind'
},
- '206831' => {
+ '206619' => {
'Header' => 'af-mctp.h',
'Line' => '19',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '206821'
+ 'type' => '206609'
}
},
'Reg' => {
@@ -7625,13 +7625,13 @@
'Return' => '1',
'ShortName' => 'pldm_transport_af_mctp_destroy'
},
- '206915' => {
+ '206703' => {
'Header' => 'af-mctp.h',
'Line' => '16',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '207139'
+ 'type' => '206927'
}
},
'Reg' => {
@@ -7640,13 +7640,13 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_init'
},
- '208326' => {
+ '208114' => {
'Header' => 'af-mctp.h',
'Line' => '37',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '206821'
+ 'type' => '206609'
},
'1' => {
'name' => 'tid',
@@ -7654,7 +7654,7 @@
},
'2' => {
'name' => 'eid',
- 'type' => '202118'
+ 'type' => '201906'
}
},
'Reg' => {
@@ -7665,13 +7665,13 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_unmap_tid'
},
- '208399' => {
+ '208187' => {
'Header' => 'af-mctp.h',
'Line' => '33',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '206821'
+ 'type' => '206609'
},
'1' => {
'name' => 'tid',
@@ -7679,7 +7679,7 @@
},
'2' => {
'name' => 'eid',
- 'type' => '202118'
+ 'type' => '201906'
}
},
'Reg' => {
@@ -7690,17 +7690,17 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_map_tid'
},
- '208640' => {
+ '208428' => {
'Header' => 'af-mctp.h',
'Line' => '28',
'Param' => {
'0' => {
'name' => 't',
- 'type' => '202319'
+ 'type' => '202107'
},
'1' => {
'name' => 'pollfd',
- 'type' => '205317'
+ 'type' => '205105'
}
},
'Reg' => {
@@ -7710,28 +7710,28 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_init_pollfd'
},
- '208718' => {
+ '208506' => {
'Header' => 'af-mctp.h',
'Line' => '23',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '206821'
+ 'type' => '206609'
}
},
'Reg' => {
'0' => 'rdi'
},
- 'Return' => '202319',
+ 'Return' => '202107',
'ShortName' => 'pldm_transport_af_mctp_core'
},
- '212437' => {
+ '212225' => {
'Header' => 'mctp-demux.h',
'Line' => '36',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '202277'
+ 'type' => '202065'
},
'1' => {
'name' => 'tid',
@@ -7739,7 +7739,7 @@
},
'2' => {
'name' => 'eid',
- 'type' => '202118'
+ 'type' => '201906'
}
},
'Reg' => {
@@ -7750,17 +7750,17 @@
'Return' => '100',
'ShortName' => 'pldm_transport_mctp_demux_unmap_tid'
},
- '212751' => {
+ '212539' => {
'Header' => 'mctp-demux.h',
'Line' => '27',
'Param' => {
'0' => {
'name' => 't',
- 'type' => '202319'
+ 'type' => '202107'
},
'1' => {
'name' => 'pollfd',
- 'type' => '205317'
+ 'type' => '205105'
}
},
'Reg' => {
@@ -7770,13 +7770,13 @@
'Return' => '100',
'ShortName' => 'pldm_transport_mctp_demux_init_pollfd'
},
- '220587' => {
+ '220375' => {
'Header' => 'transport.h',
'Line' => '31',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '202319'
+ 'type' => '202107'
},
'1' => {
'name' => 'timeout',
@@ -7786,7 +7786,7 @@
'Return' => '100',
'ShortName' => 'pldm_transport_poll'
},
- '222786' => {
+ '222574' => {
'Header' => 'file_io.h',
'Line' => '912',
'Param' => {
@@ -7806,7 +7806,7 @@
'Return' => '100',
'ShortName' => 'encode_new_file_with_metadata_resp'
},
- '222986' => {
+ '222774' => {
'Header' => 'file_io.h',
'Line' => '898',
'Param' => {
@@ -7860,7 +7860,7 @@
'Return' => '100',
'ShortName' => 'decode_new_file_with_metadata_req'
},
- '223218' => {
+ '223006' => {
'Header' => 'file_io.h',
'Line' => '881',
'Param' => {
@@ -7885,7 +7885,7 @@
'Return' => '100',
'ShortName' => 'decode_new_file_with_metadata_resp'
},
- '223319' => {
+ '223107' => {
'Header' => 'file_io.h',
'Line' => '866',
'Param' => {
@@ -7935,7 +7935,7 @@
'Return' => '100',
'ShortName' => 'encode_new_file_with_metadata_req'
},
- '223616' => {
+ '223404' => {
'Header' => 'file_io.h',
'Line' => '824',
'Param' => {
@@ -7955,7 +7955,7 @@
'Return' => '100',
'ShortName' => 'encode_file_ack_with_meta_data_resp'
},
- '223811' => {
+ '223599' => {
'Header' => 'file_io.h',
'Line' => '811',
'Param' => {
@@ -8009,7 +8009,7 @@
'Return' => '100',
'ShortName' => 'decode_file_ack_with_meta_data_req'
},
- '224023' => {
+ '223811' => {
'Header' => 'file_io.h',
'Line' => '794',
'Param' => {
@@ -8034,7 +8034,7 @@
'Return' => '100',
'ShortName' => 'decode_file_ack_with_meta_data_resp'
},
- '224119' => {
+ '223907' => {
'Header' => 'file_io.h',
'Line' => '781',
'Param' => {
@@ -8084,7 +8084,7 @@
'Return' => '100',
'ShortName' => 'encode_file_ack_with_meta_data_req'
},
- '224416' => {
+ '224204' => {
'Header' => 'file_io.h',
'Line' => '741',
'Param' => {
@@ -8109,7 +8109,7 @@
'Return' => '100',
'ShortName' => 'decode_file_ack_resp'
},
- '224517' => {
+ '224305' => {
'Header' => 'file_io.h',
'Line' => '730',
'Param' => {
@@ -8137,7 +8137,7 @@
'Return' => '100',
'ShortName' => 'encode_file_ack_req'
},
- '224752' => {
+ '224540' => {
'Header' => 'file_io.h',
'Line' => '718',
'Param' => {
@@ -8157,7 +8157,7 @@
'Return' => '100',
'ShortName' => 'encode_file_ack_resp'
},
- '224942' => {
+ '224730' => {
'Header' => 'file_io.h',
'Line' => '706',
'Param' => {
@@ -8191,7 +8191,7 @@
'Return' => '100',
'ShortName' => 'decode_file_ack_req'
},
- '225084' => {
+ '224872' => {
'Header' => 'file_io.h',
'Line' => '675',
'Param' => {
@@ -8221,7 +8221,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_by_type_resp'
},
- '225199' => {
+ '224987' => {
'Header' => 'file_io.h',
'Line' => '661',
'Param' => {
@@ -8258,7 +8258,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_by_type_req'
},
- '225469' => {
+ '225257' => {
'Header' => 'file_io.h',
'Line' => '644',
'Param' => {
@@ -8286,7 +8286,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_by_type_resp'
},
- '225699' => {
+ '225487' => {
'Header' => 'file_io.h',
'Line' => '626',
'Param' => {
@@ -8325,7 +8325,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_by_type_req'
},
- '225861' => {
+ '225649' => {
'Header' => 'file_io.h',
'Line' => '590',
'Param' => {
@@ -8350,7 +8350,7 @@
'Return' => '100',
'ShortName' => 'decode_new_file_resp'
},
- '225962' => {
+ '225750' => {
'Header' => 'file_io.h',
'Line' => '579',
'Param' => {
@@ -8378,7 +8378,7 @@
'Return' => '100',
'ShortName' => 'encode_new_file_req'
},
- '226197' => {
+ '225985' => {
'Header' => 'file_io.h',
'Line' => '567',
'Param' => {
@@ -8398,7 +8398,7 @@
'Return' => '100',
'ShortName' => 'encode_new_file_resp'
},
- '226387' => {
+ '226175' => {
'Header' => 'file_io.h',
'Line' => '555',
'Param' => {
@@ -8432,7 +8432,7 @@
'Return' => '100',
'ShortName' => 'decode_new_file_req'
},
- '226529' => {
+ '226317' => {
'Header' => 'file_io.h',
'Line' => '523',
'Param' => {
@@ -8462,7 +8462,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_by_type_memory_resp'
},
- '226644' => {
+ '226432' => {
'Header' => 'file_io.h',
'Line' => '509',
'Param' => {
@@ -8504,7 +8504,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_by_type_memory_req'
},
- '226929' => {
+ '226717' => {
'Header' => 'file_io.h',
'Line' => '491',
'Param' => {
@@ -8532,7 +8532,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_by_type_memory_resp'
},
- '227159' => {
+ '226947' => {
'Header' => 'file_io.h',
'Line' => '473',
'Param' => {
@@ -8576,7 +8576,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_by_type_memory_req'
},
- '227336' => {
+ '227124' => {
'Header' => 'file_io.h',
'Line' => '435',
'Param' => {
@@ -8600,7 +8600,7 @@
'Return' => '100',
'ShortName' => 'encode_write_file_resp'
},
- '227551' => {
+ '227339' => {
'Header' => 'file_io.h',
'Line' => '422',
'Param' => {
@@ -8630,7 +8630,7 @@
'Return' => '100',
'ShortName' => 'decode_write_file_resp'
},
- '227661' => {
+ '227449' => {
'Header' => 'file_io.h',
'Line' => '410',
'Param' => {
@@ -8658,7 +8658,7 @@
'Return' => '100',
'ShortName' => 'encode_write_file_req'
},
- '227896' => {
+ '227684' => {
'Header' => 'file_io.h',
'Line' => '391',
'Param' => {
@@ -8696,7 +8696,7 @@
'Return' => '100',
'ShortName' => 'decode_write_file_req'
},
- '228051' => {
+ '227839' => {
'Header' => 'file_io.h',
'Line' => '377',
'Param' => {
@@ -8720,7 +8720,7 @@
'Return' => '100',
'ShortName' => 'encode_read_file_resp'
},
- '228266' => {
+ '228054' => {
'Header' => 'file_io.h',
'Line' => '359',
'Param' => {
@@ -8754,7 +8754,7 @@
'Return' => '100',
'ShortName' => 'decode_read_file_resp'
},
- '228402' => {
+ '228190' => {
'Header' => 'file_io.h',
'Line' => '344',
'Param' => {
@@ -8782,7 +8782,7 @@
'Return' => '100',
'ShortName' => 'encode_read_file_req'
},
- '228637' => {
+ '228425' => {
'Header' => 'file_io.h',
'Line' => '330',
'Param' => {
@@ -8816,7 +8816,7 @@
'Return' => '100',
'ShortName' => 'decode_read_file_req'
},
- '228773' => {
+ '228561' => {
'Header' => 'file_io.h',
'Line' => '274',
'Param' => {
@@ -8860,7 +8860,7 @@
'Return' => '100',
'ShortName' => 'decode_get_file_table_resp'
},
- '228947' => {
+ '228735' => {
'Header' => 'file_io.h',
'Line' => '258',
'Param' => {
@@ -8888,7 +8888,7 @@
'Return' => '100',
'ShortName' => 'encode_get_file_table_req'
},
- '229174' => {
+ '228962' => {
'Header' => 'file_io.h',
'Line' => '244',
'Param' => {
@@ -8928,7 +8928,7 @@
'Return' => '100',
'ShortName' => 'encode_get_file_table_resp'
},
- '229532' => {
+ '229320' => {
'Header' => 'file_io.h',
'Line' => '227',
'Param' => {
@@ -8962,7 +8962,7 @@
'Return' => '100',
'ShortName' => 'decode_get_file_table_req'
},
- '229667' => {
+ '229455' => {
'Header' => 'file_io.h',
'Line' => '183',
'Param' => {
@@ -8992,7 +8992,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_memory_resp'
},
- '229776' => {
+ '229564' => {
'Header' => 'file_io.h',
'Line' => '169',
'Param' => {
@@ -9032,7 +9032,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_memory_req'
},
- '230035' => {
+ '229823' => {
'Header' => 'file_io.h',
'Line' => '152',
'Param' => {
@@ -9060,7 +9060,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_memory_resp'
},
- '230256' => {
+ '230044' => {
'Header' => 'file_io.h',
'Line' => '136',
'Param' => {
@@ -9099,7 +9099,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_memory_req'
},
- '231305' => {
+ '231093' => {
'Header' => 'host.h',
'Line' => '101',
'Param' => {
@@ -9134,7 +9134,7 @@
'Return' => '100',
'ShortName' => 'encode_get_alert_status_resp'
},
- '231553' => {
+ '231341' => {
'Header' => 'host.h',
'Line' => '86',
'Param' => {
@@ -9159,7 +9159,7 @@
'Return' => '100',
'ShortName' => 'decode_get_alert_status_req'
},
- '231636' => {
+ '231424' => {
'Header' => 'host.h',
'Line' => '70',
'Param' => {
@@ -9193,7 +9193,7 @@
'Return' => '100',
'ShortName' => 'decode_get_alert_status_resp'
},
- '231775' => {
+ '231563' => {
'Header' => 'host.h',
'Line' => '52',
'Param' => {
@@ -9217,7 +9217,7 @@
'Return' => '100',
'ShortName' => 'encode_get_alert_status_req'
},
- '232843' => {
+ '232631' => {
'Header' => 'platform.h',
'Line' => '47',
'Param' => {
@@ -9254,7 +9254,7 @@
'Return' => '100',
'ShortName' => 'encode_bios_attribute_update_event_req'
},
- '234695' => {
+ '234483' => {
'Header' => 'file_io.h',
'Line' => '160',
'Param' => {
@@ -9264,7 +9264,7 @@
},
'1' => {
'name' => 'resp',
- 'type' => '236414'
+ 'type' => '236202'
},
'2' => {
'name' => 'resp_len',
@@ -9285,13 +9285,13 @@
'Return' => '100',
'ShortName' => 'encode_oem_meta_file_io_read_resp'
},
- '236429' => {
+ '236217' => {
'Header' => 'file_io.h',
'Line' => '147',
'Param' => {
'0' => {
'name' => 'resp',
- 'type' => '236414'
+ 'type' => '236202'
}
},
'Reg' => {
@@ -9300,7 +9300,7 @@
'Return' => '2579',
'ShortName' => 'pldm_oem_meta_file_io_read_resp_data'
},
- '236477' => {
+ '236265' => {
'Header' => 'file_io.h',
'Line' => '137',
'Param' => {
@@ -9314,13 +9314,13 @@
},
'2' => {
'name' => 'req',
- 'type' => '237597'
+ 'type' => '237385'
}
},
'Return' => '100',
'ShortName' => 'decode_oem_meta_file_io_read_req'
},
- '237602' => {
+ '237390' => {
'Header' => 'file_io.h',
'Line' => '126',
'Param' => {
@@ -9355,7 +9355,7 @@
'Return' => '100',
'ShortName' => 'decode_oem_meta_file_io_req'
},
- '238036' => {
+ '237824' => {
'Header' => 'file_io.h',
'Line' => '113',
'Param' => {
@@ -9369,7 +9369,7 @@
},
'2' => {
'name' => 'req',
- 'type' => '238031'
+ 'type' => '237819'
},
'3' => {
'name' => 'req_length',
@@ -9379,13 +9379,13 @@
'Return' => '100',
'ShortName' => 'decode_oem_meta_file_io_write_req'
},
- '238985' => {
+ '238773' => {
'Header' => 'file_io.h',
'Line' => '102',
'Param' => {
'0' => {
'name' => 'req',
- 'type' => '238031'
+ 'type' => '237819'
}
},
'Reg' => {
@@ -12563,61 +12563,61 @@
'Size' => '8',
'Type' => 'Pointer'
},
- '195752' => {
+ '195755' => {
'BaseType' => '93323',
'Name' => 'set_effecter_state_field*',
'Size' => '8',
'Type' => 'Pointer'
},
- '196728' => {
+ '196731' => {
'BaseType' => '91111',
'Name' => 'struct pldm_state_sensor_pdr*',
'Size' => '8',
'Type' => 'Pointer'
},
- '196733' => {
- 'BaseType' => '196728',
+ '196736' => {
+ 'BaseType' => '196731',
'Name' => 'struct pldm_state_sensor_pdr*const',
'Size' => '8',
'Type' => 'Const'
},
- '196738' => {
+ '196741' => {
'BaseType' => '91322',
'Name' => 'struct state_sensor_possible_states const*',
'Size' => '8',
'Type' => 'Pointer'
},
- '196743' => {
- 'BaseType' => '196738',
+ '196746' => {
+ 'BaseType' => '196741',
'Name' => 'struct state_sensor_possible_states const*const',
'Size' => '8',
'Type' => 'Const'
},
- '197133' => {
+ '196921' => {
'BaseType' => '91343',
'Name' => 'struct pldm_state_effecter_pdr*',
'Size' => '8',
'Type' => 'Pointer'
},
- '197138' => {
- 'BaseType' => '197133',
+ '196926' => {
+ 'BaseType' => '196921',
'Name' => 'struct pldm_state_effecter_pdr*const',
'Size' => '8',
'Type' => 'Const'
},
- '197143' => {
+ '196931' => {
'BaseType' => '93275',
'Name' => 'struct state_effecter_possible_states const*',
'Size' => '8',
'Type' => 'Pointer'
},
- '197148' => {
- 'BaseType' => '197143',
+ '196936' => {
+ 'BaseType' => '196931',
'Name' => 'struct state_effecter_possible_states const*const',
'Size' => '8',
'Type' => 'Const'
},
- '200126' => {
+ '199914' => {
'Line' => '19',
'Memb' => {
'0' => {
@@ -12637,13 +12637,13 @@
'Source' => 'instance-id.c',
'Type' => 'Struct'
},
- '200165' => {
+ '199953' => {
'Line' => '24',
'Memb' => {
'0' => {
'name' => 'state',
'offset' => '0',
- 'type' => '200207'
+ 'type' => '199995'
},
'1' => {
'name' => 'lock_db_fd',
@@ -12657,31 +12657,31 @@
'Source' => 'instance-id.c',
'Type' => 'Struct'
},
- '200207' => {
- 'BaseType' => '200126',
+ '199995' => {
+ 'BaseType' => '199914',
'Name' => 'struct pldm_tid_state[256]',
'Size' => '2048',
'Type' => 'Array'
},
- '200763' => {
- 'BaseType' => '200165',
+ '200551' => {
+ 'BaseType' => '199953',
'Name' => 'struct pldm_instance_db*',
'Size' => '8',
'Type' => 'Pointer'
},
- '201150' => {
+ '200938' => {
'BaseType' => '187',
'Name' => 'pldm_instance_id_t*',
'Size' => '8',
'Type' => 'Pointer'
},
- '201326' => {
- 'BaseType' => '200763',
+ '201114' => {
+ 'BaseType' => '200551',
'Name' => 'struct pldm_instance_db**',
'Size' => '8',
'Type' => 'Pointer'
},
- '202118' => {
+ '201906' => {
'BaseType' => '121',
'Header' => 'pldm.h',
'Line' => '13',
@@ -12689,7 +12689,7 @@
'Size' => '1',
'Type' => 'Typedef'
},
- '202233' => {
+ '202021' => {
'BaseType' => '284',
'Header' => 'pldm.h',
'Line' => '30',
@@ -12697,13 +12697,13 @@
'Size' => '4',
'Type' => 'Typedef'
},
- '202251' => {
+ '202039' => {
'Line' => '26',
'Memb' => {
'0' => {
'name' => 'transport',
'offset' => '0',
- 'type' => '202324'
+ 'type' => '202112'
},
'1' => {
'name' => 'socket',
@@ -12713,12 +12713,12 @@
'2' => {
'name' => 'tid_eid_map',
'offset' => '68',
- 'type' => '206020'
+ 'type' => '205808'
},
'3' => {
'name' => 'socket_send_buf',
'offset' => '768',
- 'type' => '204940'
+ 'type' => '204728'
}
},
'Name' => 'struct pldm_transport_mctp_demux',
@@ -12727,19 +12727,19 @@
'Source' => 'mctp-demux.c',
'Type' => 'Struct'
},
- '202277' => {
- 'BaseType' => '202251',
+ '202065' => {
+ 'BaseType' => '202039',
'Name' => 'struct pldm_transport_mctp_demux*',
'Size' => '8',
'Type' => 'Pointer'
},
- '202319' => {
- 'BaseType' => '202324',
+ '202107' => {
+ 'BaseType' => '202112',
'Name' => 'struct pldm_transport*',
'Size' => '8',
'Type' => 'Pointer'
},
- '202324' => {
+ '202112' => {
'Header' => 'transport.h',
'Line' => '18',
'Memb' => {
@@ -12756,17 +12756,17 @@
'2' => {
'name' => 'recv',
'offset' => '22',
- 'type' => '205251'
+ 'type' => '205039'
},
'3' => {
'name' => 'send',
'offset' => '36',
- 'type' => '205292'
+ 'type' => '205080'
},
'4' => {
'name' => 'init_pollfd',
'offset' => '50',
- 'type' => '205372'
+ 'type' => '205160'
}
},
'Name' => 'struct pldm_transport',
@@ -12774,19 +12774,19 @@
'Size' => '40',
'Type' => 'Struct'
},
- '202460' => {
+ '202248' => {
'BaseType' => '175',
'Name' => 'pldm_tid_t*',
'Size' => '8',
'Type' => 'Pointer'
},
- '202563' => {
- 'BaseType' => '202277',
+ '202351' => {
+ 'BaseType' => '202065',
'Name' => 'struct pldm_transport_mctp_demux**',
'Size' => '8',
'Type' => 'Pointer'
},
- '204660' => {
+ '204448' => {
'BaseType' => '46',
'Header' => 'int-ll64.h',
'Line' => '21',
@@ -12795,7 +12795,7 @@
'Size' => '1',
'Type' => 'Typedef'
},
- '204672' => {
+ '204460' => {
'BaseType' => '53',
'Header' => 'int-ll64.h',
'Line' => '24',
@@ -12804,7 +12804,7 @@
'Size' => '2',
'Type' => 'Typedef'
},
- '204940' => {
+ '204728' => {
'Header' => 'socket.h',
'Line' => '5',
'Memb' => {
@@ -12829,14 +12829,14 @@
'Size' => '12',
'Type' => 'Struct'
},
- '205251' => {
+ '205039' => {
'Name' => 'pldm_requester_rc_t(*)(struct pldm_transport*, pldm_tid_t*, void**, size_t*)',
'Param' => {
'0' => {
- 'type' => '202319'
+ 'type' => '202107'
},
'1' => {
- 'type' => '202460'
+ 'type' => '202248'
},
'2' => {
'type' => '52697'
@@ -12845,15 +12845,15 @@
'type' => '13089'
}
},
- 'Return' => '202233',
+ 'Return' => '202021',
'Size' => '8',
'Type' => 'FuncPtr'
},
- '205292' => {
+ '205080' => {
'Name' => 'pldm_requester_rc_t(*)(struct pldm_transport*, pldm_tid_t, void const*, size_t)',
'Param' => {
'0' => {
- 'type' => '202319'
+ 'type' => '202107'
},
'1' => {
'type' => '175'
@@ -12865,17 +12865,17 @@
'type' => '1145'
}
},
- 'Return' => '202233',
+ 'Return' => '202021',
'Size' => '8',
'Type' => 'FuncPtr'
},
- '205317' => {
- 'BaseType' => '205322',
+ '205105' => {
+ 'BaseType' => '205110',
'Name' => 'struct pollfd*',
'Size' => '8',
'Type' => 'Pointer'
},
- '205322' => {
+ '205110' => {
'Header' => 'poll.h',
'Line' => '36',
'Memb' => {
@@ -12900,21 +12900,21 @@
'Size' => '8',
'Type' => 'Struct'
},
- '205372' => {
+ '205160' => {
'Name' => 'int(*)(struct pldm_transport*, struct pollfd*)',
'Param' => {
'0' => {
- 'type' => '202319'
+ 'type' => '202107'
},
'1' => {
- 'type' => '205317'
+ 'type' => '205105'
}
},
'Return' => '100',
'Size' => '8',
'Type' => 'FuncPtr'
},
- '205377' => {
+ '205165' => {
'BaseType' => '53',
'Header' => 'socket.h',
'Line' => '10',
@@ -12923,14 +12923,14 @@
'Size' => '2',
'Type' => 'Typedef'
},
- '205754' => {
+ '205542' => {
'Header' => 'mctp.h',
'Line' => '18',
'Memb' => {
'0' => {
'name' => 's_addr',
'offset' => '0',
- 'type' => '202118'
+ 'type' => '201906'
}
},
'Name' => 'struct mctp_addr',
@@ -12938,19 +12938,19 @@
'Size' => '1',
'Type' => 'Struct'
},
- '205780' => {
+ '205568' => {
'Header' => 'mctp.h',
'Line' => '22',
'Memb' => {
'0' => {
'name' => 'smctp_family',
'offset' => '0',
- 'type' => '205377'
+ 'type' => '205165'
},
'1' => {
'name' => '__smctp_pad0',
'offset' => '2',
- 'type' => '204672'
+ 'type' => '204460'
},
'2' => {
'name' => 'smctp_network',
@@ -12960,22 +12960,22 @@
'3' => {
'name' => 'smctp_addr',
'offset' => '8',
- 'type' => '205754'
+ 'type' => '205542'
},
'4' => {
'name' => 'smctp_type',
'offset' => '9',
- 'type' => '204660'
+ 'type' => '204448'
},
'5' => {
'name' => 'smctp_tag',
'offset' => '16',
- 'type' => '204660'
+ 'type' => '204448'
},
'6' => {
'name' => '__smctp_pad1',
'offset' => '17',
- 'type' => '204660'
+ 'type' => '204448'
}
},
'Name' => 'struct sockaddr_mctp',
@@ -12983,19 +12983,19 @@
'Size' => '12',
'Type' => 'Struct'
},
- '205884' => {
- 'BaseType' => '205780',
+ '205672' => {
+ 'BaseType' => '205568',
'Name' => 'struct sockaddr_mctp const',
'Size' => '12',
'Type' => 'Const'
},
- '205927' => {
+ '205715' => {
'Line' => '35',
'Memb' => {
'0' => {
'name' => 'transport',
'offset' => '0',
- 'type' => '202324'
+ 'type' => '202112'
},
'1' => {
'name' => 'socket',
@@ -13005,12 +13005,12 @@
'2' => {
'name' => 'tid_eid_map',
'offset' => '68',
- 'type' => '206020'
+ 'type' => '205808'
},
'3' => {
'name' => 'socket_send_buf',
'offset' => '768',
- 'type' => '204940'
+ 'type' => '204728'
},
'4' => {
'name' => 'bound',
@@ -13029,31 +13029,31 @@
'Source' => 'af-mctp.c',
'Type' => 'Struct'
},
- '206020' => {
+ '205808' => {
'BaseType' => '175',
'Name' => 'pldm_tid_t[256]',
'Size' => '256',
'Type' => 'Array'
},
- '206821' => {
- 'BaseType' => '205927',
+ '206609' => {
+ 'BaseType' => '205715',
'Name' => 'struct pldm_transport_af_mctp*',
'Size' => '8',
'Type' => 'Pointer'
},
- '206826' => {
- 'BaseType' => '205884',
+ '206614' => {
+ 'BaseType' => '205672',
'Name' => 'struct sockaddr_mctp const*',
'Size' => '8',
'Type' => 'Pointer'
},
- '207139' => {
- 'BaseType' => '206821',
+ '206927' => {
+ 'BaseType' => '206609',
'Name' => 'struct pldm_transport_af_mctp**',
'Size' => '8',
'Type' => 'Pointer'
},
- '233636' => {
+ '233424' => {
'Header' => 'file_io.h',
'Line' => '32',
'Memb' => {
@@ -13077,7 +13077,7 @@
'Size' => '8',
'Type' => 'Struct'
},
- '233703' => {
+ '233491' => {
'Header' => 'file_io.h',
'Line' => '45',
'Memb' => {
@@ -13096,7 +13096,7 @@
'Size' => '4',
'Type' => 'Struct'
},
- '233742' => {
+ '233530' => {
'Header' => 'file_io.h',
'Line' => '55',
'Memb' => {
@@ -13115,21 +13115,21 @@
'Size' => '8',
'Type' => 'Struct'
},
- '233781' => {
+ '233569' => {
'Header' => 'file_io.h',
'Line' => '70',
'Memb' => {
'0' => {
'name' => 'data',
'offset' => '0',
- 'type' => '233703'
+ 'type' => '233491'
}
},
'Name' => 'anon-union-file_io.h-70',
'Size' => '4',
'Type' => 'Union'
},
- '233799' => {
+ '233587' => {
'Header' => 'file_io.h',
'Line' => '65',
'Memb' => {
@@ -13156,33 +13156,33 @@
'4' => {
'name' => 'info',
'offset' => '18',
- 'type' => '233781'
+ 'type' => '233569'
}
},
'Name' => 'struct pldm_oem_meta_file_io_read_req',
'Size' => '16',
'Type' => 'Struct'
},
- '233877' => {
+ '233665' => {
'Header' => 'file_io.h',
'Line' => '86',
'Memb' => {
'0' => {
'name' => 'attr',
'offset' => '0',
- 'type' => '233742'
+ 'type' => '233530'
},
'1' => {
'name' => 'data',
'offset' => '0',
- 'type' => '233703'
+ 'type' => '233491'
}
},
'Name' => 'anon-union-file_io.h-86',
'Size' => '8',
'Type' => 'Union'
},
- '233905' => {
+ '233693' => {
'Header' => 'file_io.h',
'Line' => '80',
'Memb' => {
@@ -13214,7 +13214,7 @@
'5' => {
'name' => 'info',
'offset' => '18',
- 'type' => '233877'
+ 'type' => '233665'
},
'6' => {
'name' => 'data',
@@ -13226,20 +13226,20 @@
'Size' => '24',
'Type' => 'Struct'
},
- '236414' => {
- 'BaseType' => '233905',
+ '236202' => {
+ 'BaseType' => '233693',
'Name' => 'struct pldm_oem_meta_file_io_read_resp*',
'Size' => '8',
'Type' => 'Pointer'
},
- '237597' => {
- 'BaseType' => '233799',
+ '237385' => {
+ 'BaseType' => '233587',
'Name' => 'struct pldm_oem_meta_file_io_read_req*',
'Size' => '8',
'Type' => 'Pointer'
},
- '238031' => {
- 'BaseType' => '233636',
+ '237819' => {
+ 'BaseType' => '233424',
'Name' => 'struct pldm_oem_meta_file_io_write_req*',
'Size' => '8',
'Type' => 'Pointer'
diff --git a/src/dsp/platform.c b/src/dsp/platform.c
index 5391f61..79eff6d 100644
--- a/src/dsp/platform.c
+++ b/src/dsp/platform.c
@@ -22,10 +22,25 @@
const struct state_effecter_possible_states *const possible_states,
const size_t possible_states_size, size_t *const actual_size)
{
- // Encode possible states
-
size_t calculated_possible_states_size = 0;
+ if (!effecter || !possible_states || !actual_size) {
+ return PLDM_ERROR;
+ }
+
+ if (SIZE_MAX - (sizeof(*effecter) - sizeof(effecter->possible_states) <
+ possible_states_size)) {
+ return PLDM_ERROR;
+ }
+
+ if (allocation_size <
+ (sizeof(*effecter) - sizeof(effecter->possible_states)) +
+ possible_states_size) {
+ return PLDM_ERROR_INVALID_LENGTH;
+ }
+
+ // Encode possible states
+
{
char *states_ptr = (char *)possible_states;
char *const begin_states_ptr = states_ptr;
@@ -56,11 +71,6 @@
(sizeof(struct pldm_state_effecter_pdr) + possible_states_size -
sizeof(effecter->possible_states));
- if (allocation_size < *actual_size) {
- *actual_size = 0;
- return PLDM_ERROR_INVALID_LENGTH;
- }
-
// Encode rest of PDR
effecter->hdr.version = 1;