]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: i386msdos uninitialised read
authorAlan Modra <amodra@gmail.com>
Thu, 26 Mar 2020 07:27:18 +0000 (17:57 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 26 Mar 2020 09:32:42 +0000 (20:02 +1030)
Another fix.

* i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread.

bfd/ChangeLog
bfd/i386msdos.c

index b5a2e7d447d5b13afa0c8c98de5aea278046b0ae..441725f0ebf2ee80974bb8035d6625e384affbd6 100644 (file)
@@ -1,3 +1,7 @@
+2020-03-26  Alan Modra  <amodra@gmail.com>
+
+       * i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread.
+
 2020-03-26  Alan Modra  <amodra@gmail.com>
 
        * vms-alpha.c (dst_define_location): Limit size of dst_ptr_offsets
index e9307a7a4243df3a95d6715d01bbf35e1e7ab645..38bb4410347e17a2f25494dee87668d8e0e6e0f9 100644 (file)
@@ -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);