From: Alan Modra Date: Thu, 26 Mar 2020 07:27:18 +0000 (+1030) Subject: Re: i386msdos uninitialised read X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff7685105468702de87b75599b1ea88cc309541c;p=binutils-gdb.git Re: i386msdos uninitialised read Another fix. * i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b5a2e7d447d..441725f0ebf 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2020-03-26 Alan Modra + + * i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread. + 2020-03-26 Alan Modra * vms-alpha.c (dst_define_location): Limit size of dst_ptr_offsets diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index e9307a7a424..38bb4410347 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -50,7 +50,7 @@ msdos_object_p (bfd *abfd) bfd_size_type size; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (size = bfd_bread (&hdr, sizeof (hdr), abfd)) < DOS_HDR_SIZE) + || (size = bfd_bread (&hdr, sizeof (hdr), abfd)) + 1 < DOS_HDR_SIZE + 1) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format);