intel / ledmon

Enclosure LED Utilities
GNU General Public License v2.0
72 stars 49 forks source link

npem, vmd: fix ibpi_value lists getter. #116

Closed mtkaczyk closed 1 year ago

mtkaczyk commented 1 year ago

The last element on list must be IBPI_PATTERN_UNKNOWN, otherwise we can read out of bound memory. It is possible now when not supported pattern is requested with --set-slot for VMD. In my case it doesn't produce issue because it reads zeros from memory after the array. Fix that for vmd controller by adding IBPI_PATTERN_UNKNOWN element to array with no value. Add validation of returned value where necessary.

To avoid such issues appropriative assert is added.

List of changes:

Now caller can verify what was returned and react accordingly if needed.

Signed-off-by: Mariusz Tkaczyk mariusz.tkaczyk@linux.intel.com