From 7391722c40c2ba598072a44ed71b692090e8af82 Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Wed, 15 Mar 2023 16:14:03 +0800 Subject: [PATCH] amdfwtool: Add asserting before accessing array combo_config Change-Id: Ia98fdbee4c4005562662313ebe2478d0aeb879bc Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/73724 Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) Reviewed-by: Martin L Roth --- util/amdfwtool/amdfwtool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index fc0668fab6..f16f758cf7 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -2296,6 +2296,7 @@ int main(int argc, char **argv) break; case AMDFW_OPT_COMBO1_CONFIG: cb_config.use_combo = true; + assert_fw_entry(1, MAX_COMBO_ENTRIES, &ctx); combo_config[1] = optarg; break; case AMDFW_OPT_MULTILEVEL: @@ -2676,6 +2677,7 @@ int main(int argc, char **argv) * case. */ if (cb_config.use_combo && combo_index > 0) { + assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, &ctx); open_process_config(combo_config[combo_index], &cb_config, debug);