Fix illegal memory access parsing a corrupt MACH-O format file.
authorNick Clifton <nickc@redhat.com>
Fri, 30 Apr 2021 13:31:03 +0000 (14:31 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 30 Apr 2021 13:31:03 +0000 (14:31 +0100)
PR 27801
* mach-o.c (bfd_mach_o_core_fetch_environment): Use bfd_get_32 to
read 32-bit value.

bfd/ChangeLog
bfd/mach-o.c

index cd9b1b386077a812c99c6397cf4639b118e1da97..c5a617cef97c0a36f887c0e102ea9ede0ae2ceaf 100644 (file)
@@ -1,3 +1,9 @@
+2021-04-30  Nick Clifton  <nickc@redhat.com>
+
+       PR 27801
+       * mach-o.c (bfd_mach_o_core_fetch_environment): Use bfd_get_32 to
+       read 32-bit value.
+
 2021-04-30  Nick Clifton  <nickc@redhat.com>
 
        PR 27799
index 60121c4ef4798024bb097dffc573a8db3ccec8ce..ff18ded23d50ccfba67ce1a3f1984c9411e0d111 100644 (file)
@@ -5931,7 +5931,8 @@ bfd_mach_o_core_fetch_environment (bfd *abfd,
                {
                  unsigned long val;
 
-                 val = *((unsigned long *) (buf + size - offset));
+                 val = bfd_get_32(abfd, buf + size - offset);
+
                  if (! found_nonnull)
                    {
                      if (val != 0)
This page took 0.029539 seconds and 4 git commands to generate.