summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorGeoff Lywood2010-05-27 02:04:12 +0200
committerMichael Brown2010-05-27 10:17:37 +0200
commitceba975b15c9754fb0f8f7d4787abc578c1c74fa (patch)
tree433579e69ee612064be36d8b19598cb71838625e /src/util
parent[dhcp] Honor PXEBS_SKIP option in discovery control (diff)
downloadipxe-ceba975b15c9754fb0f8f7d4787abc578c1c74fa.tar.gz
ipxe-ceba975b15c9754fb0f8f7d4787abc578c1c74fa.tar.xz
ipxe-ceba975b15c9754fb0f8f7d4787abc578c1c74fa.zip
[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.c5
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 );
}