From 2cfaeef00d61adadd88fd2d860a79b2f12a52f0a Mon Sep 17 00:00:00 2001 From: udbhav-s <50021387+udbhav-s@users.noreply.github.com> Date: Sun, 25 Feb 2024 21:17:37 -0500 Subject: [PATCH] Update build_ap.py --- ectf_tools/build_ap.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ectf_tools/build_ap.py b/ectf_tools/build_ap.py index 2c1a41db5..192a33ae9 100644 --- a/ectf_tools/build_ap.py +++ b/ectf_tools/build_ap.py @@ -34,6 +34,15 @@ def build_ap( """ try: + # Check for Component ID count exceeding 32 to prevent memory corruption in application firmware + component_id_list = component_ids.split(",") + if len(component_id_list) != int(component_cnt): + logger.error(f"List of component IDs provided of length does not match component count {component_cnt}") + exit(1) + if len(component_id_list) > 32: + logger.error("Component count cannot exceed 32") + exit(1) + for component_id in component_ids.split(","): component_id = int(component_id.strip(), 0) if i2c_address_is_blacklisted(component_id):