[PATCH] fix ar/ranlib regression with ar_fmag clobberation

Alan Modra amodra@gmail.com
Thu May 17 23:51:00 GMT 2012

On Thu, May 17, 2012 at 01:45:37PM -0700, Roland McGrath wrote:
> This change:
> 	2012-05-16  Alan Modra  <amodra@gmail.com>
> 		* archive.c (_bfd_generic_read_ar_hdr_mag):  Ensure sscanf
> 		stops at end of ar_size field.
> results in clobbering the stored ar_fmag field.  Among other things,
> this makes ranlib produce a malformed archive.

Doh!  I looked at uses of hdr after that point, and missed seeing

  memcpy (ared->arch_header, &hdr, sizeof (struct ar_hdr));

> 	* archive.c (_bfd_generic_read_ar_hdr_mag): Fix last change so as
> 	not to clobber the ar_fmag field stored in ARED->arch_header.

OK, thanks!

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list