diff options
author | Steve McIntyre <steve@einval.com> | 2021-03-23 23:49:46 +0000 |
---|---|---|
committer | Steve McIntyre <steve@einval.com> | 2021-03-23 23:49:46 +0000 |
commit | 1251a7ba86fc40a6aad8b4fecdbca2b61808d9fa (patch) | |
tree | 2125fda549aaca55cb49a48d54be77dec7fbf3df /pe.c | |
parent | 85b409232ce89b34626df9d72abedf5d4f5ccef6 (diff) | |
parent | 031e5cce385d3f96b1caa1d53495332a7eb03749 (diff) | |
download | efi-boot-shim-debian/15.3-1.tar.gz efi-boot-shim-debian/15.3-1.zip |
Update upstream source from tag 'upstream/15.3'debian/15.3-1
Update to upstream version '15.3'
with Debian dir 1b484f1c1ac270604a5a1451b34de4b0865c6211
Diffstat (limited to 'pe.c')
-rw-r--r-- | pe.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -5,7 +5,6 @@ */ #include "shim.h" -#include "hexdump.h" #include <openssl/err.h> #include <openssl/bn.h> @@ -188,7 +187,7 @@ relocate_coff (PE_COFF_LOADER_IMAGE_CONTEXT *context, EFI_STATUS get_section_vma (UINTN section_num, - char *buffer, size_t bufsz, + char *buffer, size_t bufsz UNUSED, PE_COFF_LOADER_IMAGE_CONTEXT *context, char **basep, size_t *sizep, EFI_IMAGE_SECTION_HEADER **sectionp) @@ -829,7 +828,7 @@ handle_sbat(char *SBATBase, size_t SBATSize) unsigned int i; EFI_STATUS efi_status; size_t n; - struct sbat_entry **entries = NULL; + struct sbat_section_entry **entries = NULL; char *sbat_data; size_t sbat_size; @@ -850,7 +849,7 @@ handle_sbat(char *SBATBase, size_t SBATSize) CopyMem(sbat_data, SBATBase, SBATSize); sbat_data[SBATSize] = '\0'; - efi_status = parse_sbat(sbat_data, sbat_size, &n, &entries); + efi_status = parse_sbat_section(sbat_data, sbat_size, &n, &entries); if (EFI_ERROR(efi_status)) { perror(L"Could not parse .sbat section data: %r\n", efi_status); goto err; @@ -869,7 +868,7 @@ handle_sbat(char *SBATBase, size_t SBATSize) efi_status = verify_sbat(n, entries); - cleanup_sbat_entries(n, entries); + cleanup_sbat_section_entries(n, entries); err: FreePool(sbat_data); @@ -1033,7 +1032,7 @@ handle_image (void *data, unsigned int datasize, } } else if (CompareMem(Section->Name, ".sbat\0\0\0", 8) == 0) { if (SBATBase || SBATSize) { - perror(L"Image has multiple resource sections\n"); + perror(L"Image has multiple SBAT sections\n"); return EFI_UNSUPPORTED; } @@ -1043,10 +1042,14 @@ handle_image (void *data, unsigned int datasize, return EFI_UNSUPPORTED; } - /* If it has nonzero size, and our bounds check made - * sense, sizes match, then we believe it's okay. */ + /* The virtual size corresponds to the size of the SBAT + * metadata and isn't necessarily a multiple of the file + * alignment. The on-disk size is a multiple of the file + * alignment and is zero padded. Make sure that the + * on-disk size is at least as large as virtual size, + * and ignore the section if it isn't. */ if (Section->SizeOfRawData && - Section->SizeOfRawData == Section->Misc.VirtualSize && + Section->SizeOfRawData >= Section->Misc.VirtualSize && base && end) { SBATBase = base; /* +1 because of size vs last byte location */ |