Attention is currently required from: Zheng Bao. Hello Zheng Bao,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/62483
to review the following change.
Change subject: amdfwtool: Check the length of matching string before accessing ......................................................................
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(