diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 025c424..7868193 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1276,7 +1276,7 @@ _bfd_xcoff_slurp_armap (bfd *abfd) /* The symbol table starts with a normal archive header. */ if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) - != SIZEOF_AR_HDR_BIG) + != SIZEOF_AR_HDR_BIG || hdr.namlen[3] != '\0') return FALSE; /* Skip the name (normally empty). */ @@ -1386,7 +1386,8 @@ _bfd_xcoff_archive_p (bfd *abfd) /* Now read the rest of the file header. */ amt = SIZEOF_AR_FILE_HDR - SXCOFFARMAG; - if (bfd_bread (&hdr.memoff, amt, abfd) != amt) + if (bfd_bread (&hdr.memoff, amt, abfd) != amt + || hdr.firstmemoff[XCOFFARMAG_ELEMENT_SIZE-1]) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1463,7 +1464,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd) struct xcoff_ar_hdr *hdrp; if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd) - != SIZEOF_AR_HDR) + != SIZEOF_AR_HDR || hdr.namlen[3] != '\0') { free (ret); return NULL; @@ -1495,7 +1496,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd) struct xcoff_ar_hdr_big *hdrp; if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) - != SIZEOF_AR_HDR_BIG) + != SIZEOF_AR_HDR_BIG || hdr.namlen[3] != '\0') { free (ret); return NULL; diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 525b079..c23703a 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1888,7 +1888,7 @@ xcoff64_slurp_armap (bfd *abfd) /* The symbol table starts with a normal archive header. */ if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) - != SIZEOF_AR_HDR_BIG) + != SIZEOF_AR_HDR_BIG || hdr.namlen[3] != '\0') return FALSE; /* Skip the name (normally empty). */