grub/include/grub/efi
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
..
api.h efi: Fix some malformed device path arithmetic errors 2020-07-29 16:55:48 +02:00
console.h 2008-09-24 Robert Millan <rmh@aybabtu.com> 2008-09-24 10:17:56 +00:00
console_control.h 2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> 2007-07-21 23:32:33 +00:00
disk.h 2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> 2007-07-21 23:32:33 +00:00
edid.h Use EDID on EFI. 2012-03-04 00:48:21 +01:00
efi.h RISC-V: Add to build system 2019-02-25 14:02:05 +01:00
fdtload.h arm64/efi: move EFI_PAGE definitions to efi/memory.h 2018-02-23 22:42:42 +01:00
graphics_output.h efi/gop: Add support for BLT_ONLY adapters 2020-03-10 21:40:31 +01:00
memory.h arm64/efi: move EFI_PAGE definitions to efi/memory.h 2018-02-23 22:42:42 +01:00
pci.h * include/grub/efi/pci.h: New file to define EFI PCI protocols. 2012-02-27 11:42:23 +01:00
pe32.h PE: Add RISC-V definitions 2019-02-25 11:28:44 +01:00
tpm.h efi/tpm.h: Fix hash_log_extend_event definition. 2019-03-25 15:16:26 +01:00
uga_draw.h * include/grub/efi/uga_draw.h (GRUB_EFI_UGA_GLT_MAX): Rename to ... 2010-06-11 22:15:35 +01:00