diff options
author | Geoff Lywood <glywood@vmware.com> | 2010-05-26 17:04:12 -0700 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2010-05-27 09:17:37 +0100 |
commit | ceba975b15c9754fb0f8f7d4787abc578c1c74fa (patch) | |
tree | 433579e69ee612064be36d8b19598cb71838625e /src/util | |
parent | 620b98ee4b9d8fa87c56bfa72b4391c1eed9dce6 (diff) | |
download | ipxe-ceba975b15c9754fb0f8f7d4787abc578c1c74fa.tar.gz |
[efi] Verify object format support in elf2efi.c
Currently, if you attempt to build 64-bit EFI binaries on a 32-bit
system without a suitable cross-compiling version of libbfd, the iPXE
build will die with a segmentation fault in elf2efi64.
Fix by properly handling the return value from bfd_check_format().
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/elf2efi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c index 7870bb90..1d73807e 100644 --- a/src/util/elf2efi.c +++ b/src/util/elf2efi.c @@ -247,8 +247,9 @@ static bfd * open_input_bfd ( const char *filename ) { /* The call to bfd_check_format() must be present, otherwise * we get a segfault from later BFD calls. */ - if ( bfd_check_format ( bfd, bfd_object ) < 0 ) { - eprintf ( "%s is not an object file\n", filename ); + if ( ! bfd_check_format ( bfd, bfd_object ) ) { + eprintf ( "%s is not an object file: ", filename ); + bfd_perror ( NULL ); exit ( 1 ); } |