sos_filter: Improve error checking on section_idx

Validate host provided index prior to accessing memory using that
index.

Also, consistently use a uint8_t for max_sections (to account for
integer overflow issues).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2025-05-29 19:27:39 -04:00
parent eb43b20e3b
commit 8d7e487149
2 changed files with 14 additions and 6 deletions

View File

@@ -176,7 +176,7 @@ class SosFilter:
# create an uninitialized filter object
def create_filter(self):
self._mcu.add_config_cmd("config_sos_filter oid=%d max_sections=%u"
self._mcu.add_config_cmd("config_sos_filter oid=%d max_sections=%d"
% (self._oid, self._max_sections))
self._configure_filter(is_init=True)