summaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2022-03-09 12:00:39 +1100
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-13 15:19:37 +0000
commitc38fe37ca1da6c8b682ddb74f79b139cda99fa7f (patch)
tree428f6b6ed1d8fd9f04f329d7d195fc9df9c7f1dd /host
parent33ff54fd5272ba4807c704aee8a46ee5d7d29215 (diff)
downloadvboot-c38fe37ca1da6c8b682ddb74f79b139cda99fa7f.tar.gz
host/lib/flashrom_drv.c: Ensure buffer is large enough in write op
BUG=b:207808292 BRANCH=none TEST=emerge-octopus and cros deploy'ed Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: I8a8f941f224416d872592d6cc2de4caf058cb5bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3512274 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Commit-Queue: Nikolai Artemiev <nartemiev@google.com>
Diffstat (limited to 'host')
-rw-r--r--host/lib/flashrom_drv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/host/lib/flashrom_drv.c b/host/lib/flashrom_drv.c
index 026c2c15..19d6384e 100644
--- a/host/lib/flashrom_drv.c
+++ b/host/lib/flashrom_drv.c
@@ -189,6 +189,9 @@ int flashrom_write_image(const struct firmware_image *image,
}
}
flashrom_layout_set(flashctx, layout);
+ } else if (image->size != len) {
+ r = -1;
+ goto err_cleanup;
}
flashrom_flag_set(flashctx, FLASHROM_FLAG_VERIFY_WHOLE_CHIP, false);