struct external_PEI_IMAGE_hdr image_hdr;
struct internal_filehdr internal_f;
struct internal_aouthdr internal_a;
- file_ptr opt_hdr_size;
+ bfd_size_type opt_hdr_size;
file_ptr offset;
const bfd_target *result;
if (amt < sizeof (PEAOUTHDR))
amt = sizeof (PEAOUTHDR);
- opthdr = bfd_zalloc (abfd, amt);
+ opthdr = bfd_alloc (abfd, amt);
if (opthdr == NULL)
return NULL;
if (bfd_bread (opthdr, opt_hdr_size, abfd)
!= (bfd_size_type) opt_hdr_size)
return NULL;
+ if (amt > opt_hdr_size)
+ memset (opthdr + opt_hdr_size, 0, amt - opt_hdr_size);
bfd_set_error (bfd_error_no_error);
bfd_coff_swap_aouthdr_in (abfd, opthdr, & internal_a);