aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/elf2efi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index a807491..76d02f2 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -230,7 +230,12 @@ static struct pe_header efi_pe_header = {
.SectionAlignment = EFI_IMAGE_ALIGN,
.FileAlignment = EFI_FILE_ALIGN,
.SizeOfImage = EFI_IMAGE_ALIGN,
- .SizeOfHeaders = sizeof ( efi_pe_header ),
+ .SizeOfHeaders =
+ ( sizeof ( efi_pe_header ) -
+ ( ( EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES -
+ NUMBER_OF_DIRECTORY_ENTRIES ) *
+ sizeof ( efi_pe_header.nt.OptionalHeader.
+ DataDirectory[0] ) ) ),
.DllCharacteristics =
IMAGE_DLLCHARACTERISTICS_NX_COMPAT,
.NumberOfRvaAndSizes = NUMBER_OF_DIRECTORY_ENTRIES,