util/cbfstool: fix buffer over-read

Fix unterminated array.

When looking for a type not specified in filetypes (cbfs.h:204), the
loop in lookup_name_by_type (cbfs_image.c:60) will run into a buffer
over-read.

Found-by: AFL++ 2.64d rev 1317433
Signed-off-by: Philipp Bartsch <phil@grmr.de>
Change-Id: Ib82bb92e82b09fa1e26b9ca34529ec7b98e8f7b1
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41421
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Philipp Bartsch 2020-05-15 07:17:46 +02:00 committed by Patrick Georgi
parent f39dab1b95
commit 7f5f9331d1
1 changed files with 2 additions and 1 deletions

View File

@ -210,7 +210,8 @@ static struct typedesc_t filetypes[] unused = {
{CBFS_COMPONENT_EFI, "efi"}, {CBFS_COMPONENT_EFI, "efi"},
{CBFS_COMPONENT_STRUCT, "struct"}, {CBFS_COMPONENT_STRUCT, "struct"},
{CBFS_COMPONENT_DELETED, "deleted"}, {CBFS_COMPONENT_DELETED, "deleted"},
{CBFS_COMPONENT_NULL, "null"} {CBFS_COMPONENT_NULL, "null"},
{0, NULL}
}; };
static const struct typedesc_t types_cbfs_hash[] unused = { static const struct typedesc_t types_cbfs_hash[] unused = {