grub/grub-core
Peter Jones d2cf823d0e efi: Fix some malformed device path arithmetic errors
Several places we take the length of a device path and subtract 4 from
it, without ever checking that it's >= 4. There are also cases where
this kind of malformation will result in unpredictable iteration,
including treating the length from one dp node as the type in the next
node. These are all errors, no matter where the data comes from.

This patch adds a checking macro, GRUB_EFI_DEVICE_PATH_VALID(), which
can be used in several places, and makes GRUB_EFI_NEXT_DEVICE_PATH()
return NULL and GRUB_EFI_END_ENTIRE_DEVICE_PATH() evaluate as true when
the length is too small. Additionally, it makes several places in the
code check for and return errors in these cases.

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-07-29 16:55:48 +02:00
..
boot A workaround for clang problem assembling startup_raw.S 2019-04-08 15:22:10 +10:00
bus calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
commands malloc: Use overflow checking primitives where we do complex allocations 2020-07-29 16:55:47 +02:00
disk lvm: Fix two more potential data-dependent alloc overflows 2020-07-29 16:55:48 +02:00
efiemu calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
font font: Do not load more than one NAME section 2020-07-29 16:55:48 +02:00
fs hfsplus: Fix two more overflows 2020-07-29 16:55:48 +02:00
gdb i386, x86_64, ppc: fix switch fallthrough cases with GCC7 2017-04-04 19:23:55 +03:00
gettext verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
gfxmenu gfxmenu: Fix double free in load_image() 2020-07-29 16:55:48 +02:00
hello * grub-core/commands/gptsync.c: Fix typographic quoting. 2012-03-03 13:05:08 +01:00
hook * grub-core/hook/datehook.c (grub_read_hook_datetime): Small stylistic 2011-11-11 21:03:49 +01:00
io calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
kern efi: Fix some malformed device path arithmetic errors 2020-07-29 16:55:48 +02:00
lib relocator: Fix grub_relocator_alloc_chunk_align() top memory allocation 2020-07-29 16:55:48 +02:00
loader efi: Fix some malformed device path arithmetic errors 2020-07-29 16:55:48 +02:00
mmap calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
net tftp: Do not use priority queue 2020-07-29 16:55:48 +02:00
normal malloc: Use overflow checking primitives where we do complex allocations 2020-07-29 16:55:47 +02:00
osdep calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
partmap calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
parttool * grub-core/net/http.c: Add TRANSLATORS comments. 2012-03-05 16:42:26 +01:00
script script: Avoid a use-after-free when redefining a function during execution 2020-07-29 16:55:48 +02:00
term term: Fix overflow on user inputs 2020-07-29 16:55:48 +02:00
tests calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
video malloc: Use overflow checking primitives where we do complex allocations 2020-07-29 16:55:47 +02:00
gdb_grub.in * grub-core/gdb_grub.in: Fix overflow and wrong field. 2013-10-14 03:40:20 +02:00
genemuinit.sh use MODULE_FILES for genemuinit* instead of MOD_FILES 2014-01-18 23:15:40 +04:00
genemuinitheader.sh use MODULE_FILES for genemuinit* instead of MOD_FILES 2014-01-18 23:15:40 +04:00
genmod.sh.in .mod files: Strip annobin annotations and .eh_frame, and their relocations 2018-03-05 14:08:22 +01:00
genmoddep.awk enforcing fixup 2017-08-14 16:27:10 +02:00
gensyminfo.sh.in Fix shebang for termux. 2017-05-03 12:49:31 +02:00
gensymlist.sh Make 'make check' work on emu. 2013-04-27 02:00:16 +02:00
gentrigtables.c * grub-core/gentrigtables.c: Make tables const. 2013-03-01 11:15:09 +01:00
gmodule.pl.in * grub-core/gmodule.pl.in: Accept newer binutils which output 2014-09-21 18:23:23 +02:00
Makefile.am RISC-V: Add to build system 2019-02-25 14:02:05 +01:00
Makefile.core.def tpm: Enable module for all EFI platforms 2020-05-25 14:50:42 +02:00
modinfo.sh.in Fix shebang for termux. 2017-05-03 12:49:31 +02:00