coreboot-kgpe-d16/src/commonlib
Julius Werner a4c0e60725 commonlib/cbfs: Fix minor parser edge cases
This patch fixes a few minor CBFS parsing edge cases that could lead to
unintended behavior: the CBFS attribute parser could have run into an
infinite loop if an attribute's length was (accidentally or maliciously)
invalid. A length of 0 would have caused it to read the same attribute
over and over again without making forward progress, while a very large
length could have caused an overflow that makes it go backwards to find
the next attribute. Also, the filename was not guaranteed to be
null-terminated which could have resulted in out-of-bounds reads on a
few error messages.

Finally, clarify the validity guarantees for CBFS header fields offered
by cbfs_walk() in the comment explaining cbfs_mdata.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: Ie569786e5bec355b522f6580f53bdd8b16a4d726
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57569
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
2021-09-15 01:19:22 +00:00
..
bsd commonlib/cbfs: Fix minor parser edge cases 2021-09-15 01:19:22 +00:00
include/commonlib Move post_codes.h to commonlib/console/ 2021-08-04 15:15:51 +00:00
storage src/commonlib: Drop unneeded empty lines 2020-09-21 15:53:25 +00:00
cbfs.c commonlib/cbfs.c: Remove unuse <console/console.h> 2021-02-15 10:51:24 +00:00
fsp_relocate.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
iobuf.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
Makefile.inc Move elog_internal.h to commonlib/bsd/include 2021-08-04 15:15:55 +00:00
mem_pool.c mem_pool: Track the last two allocations (not just one) 2021-04-06 07:50:05 +00:00
region.c commonlib/region: Turn addrspace_32bit into a more official API 2021-04-21 02:06:26 +00:00
sort.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00