summaryrefslogtreecommitdiff
path: root/firmware/lib
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-08-01 12:45:47 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-13 13:03:55 +0000
commit7ceb2ae796e6cd2b38a3344cffc8aa93032345ec (patch)
treeca660310a09ce55b8009366940708277ae9f3c37 /firmware/lib
parent7ad9f51996d9d950dfbf6c11c82144f7026a68aa (diff)
downloadvboot-7ceb2ae796e6cd2b38a3344cffc8aa93032345ec.tar.gz
vboot: properly check failure from VbExGetLocalizationCount
Check the return value and result of calling VbExGetLocalizationCount. If something is awry, fall back to using one language entry. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Ieeea54bfed303a98d16f15aceab47f1ffdd10d6d Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1729773 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'firmware/lib')
-rw-r--r--firmware/lib/vboot_ui_menu.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 628b6b89..3c202c28 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -713,9 +713,8 @@ static vb2_error_t vb2_init_menus(struct vb2_context *ctx)
int i;
/* Initialize language menu with the correct amount of entries. */
- VbExGetLocalizationCount(&count);
- if (!count)
- count = 1; /* Always need at least one language entry. */
+ if (VB2_SUCCESS != VbExGetLocalizationCount(&count) || count == 0)
+ count = 1; /* Fall back to 1 language entry on failure */
items = malloc(count * sizeof(struct vb2_menu_item));
if (!items)