summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorZheng Bao <fishbaozi@gmail.com>2023-03-11 10:29:56 +0800
committerMartin L Roth <gaumless@gmail.com>2023-03-16 14:40:02 +0000
commit17551ae865d187231858e2e359b3c00d87ea042e (patch)
tree6e0badf843f4eba4a72afd778983b2f2ee7c8eea /util
parent7391722c40c2ba598072a44ed71b692090e8af82 (diff)
amdfwtool: Check combo_index before checking the combo_config
Otherwise Checking combo_config[++combo_index] causes Out-of-Bounds access. Change-Id: I50d466ee98edfb18c01fc7ba43e929640b33c7c1 Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/73647 Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
Diffstat (limited to 'util')
-rw-r--r--util/amdfwtool/amdfwtool.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c
index f16f758cf7..738123b68f 100644
--- a/util/amdfwtool/amdfwtool.c
+++ b/util/amdfwtool/amdfwtool.c
@@ -2789,7 +2789,8 @@ int main(int argc, char **argv)
BHD2_COOKIE, &ctx);
}
}
- } while (cb_config.use_combo && combo_config[++combo_index] != NULL);
+ } while (cb_config.use_combo && ++combo_index < MAX_COMBO_ENTRIES &&
+ combo_config[combo_index] != NULL);
targetfd = open(output, O_RDWR | O_CREAT | O_TRUNC, 0666);
if (targetfd >= 0) {