Attention is currently required from: Zheng Bao.
Bao Zheng would like Zheng Bao to review this change.
amdfwtool: Check the length of matching string before accessing
If AB recovery is enabled and get a "Lx" in fw.cfg, wrong character
is got or access violation happens.
Change-Id: Ibd8ffe34fd44d860ec2115cd36117da7b02169cd
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
---
M util/amdfwtool/data_parse.c
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/83/62483/1
diff --git a/util/amdfwtool/data_parse.c b/util/amdfwtool/data_parse.c
index 7f9816b..fc3e6fa 100644
--- a/util/amdfwtool/data_parse.c
+++ b/util/amdfwtool/data_parse.c
@@ -532,7 +532,8 @@
if (cb_config->recovery_ab == 0)
ch_lvl = oneline[match[3].rm_so + 1];
else
- ch_lvl = oneline[match[3].rm_so + 2];
+ if ((match[3].rm_eo - match[3].rm_so) >= 3)
+ ch_lvl = oneline[match[3].rm_so + 2];
}
if (find_register_fw_filename_psp_dir(
To view, visit change 62483. To unsubscribe, or for help writing mail filters, visit settings.