]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Fix debug directory size
authorMichael Brown <mcb30@ipxe.org>
Tue, 1 Sep 2015 00:29:23 +0000 (01:29 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 1 Sep 2015 00:35:03 +0000 (01:35 +0100)
The debug directory size specified in the data directory should cover
only the EFI_IMAGE_DEBUG_DIRECTORY_ENTRY structure, not the whole of
the .debug section.

Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/util/elf2efi.c

index e68fa5d142b8ab42b137724c24e7ec71defda7a7..eb8f51ee5bee113d46fe5394d5b1473820e6912a 100644 (file)
@@ -600,7 +600,7 @@ create_debug_section ( struct pe_header *pe_header, const char *filename ) {
        debugdir = &(pe_header->nt.OptionalHeader.DataDirectory
                     [EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
        debugdir->VirtualAddress = debug->hdr.VirtualAddress;
-       debugdir->Size = debug->hdr.Misc.VirtualSize;
+       debugdir->Size = sizeof ( contents->debug );
 
        return debug;
 }