]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix a potential buffer overrun qwhen writing out PE aux entries.
authorNick Clifton <nickc@redhat.com>
Tue, 16 Mar 2021 12:44:50 +0000 (12:44 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 16 Mar 2021 12:44:50 +0000 (12:44 +0000)
* peXXigen.c (_bfd_XXi_swap_aux_out): Avoid potential buffer
overrun by using sizeof of the destination x_fname field as the
limit for a memcpy.

* coff/internal.h (struct internal_auxent): Fix a couple of typos
in comment describing the x_fname field.

bfd/ChangeLog
bfd/peXXigen.c
include/ChangeLog
include/coff/internal.h

index 70203b1254fbc6a192047775f3f239144d4d4200..2bea06278b83033ca18a5654b6a78fbfeb036c38 100644 (file)
@@ -1,3 +1,9 @@
+2021-03-16  Nick Clifton  <nickc@redhat.com>
+
+       * peXXigen.c (_bfd_XXi_swap_aux_out): Avoid potential buffer
+       overrun by using sizeof of the destination x_fname field as the
+       limit for a memcpy.
+
 2021-03-16  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
 
        * elfxx-riscv.c (riscv_std_z_ext_strtab): Add zba, zbb and zbc.
index 83bbac51af78653bc612232596ab1ca378edfa86..b3706723c83c8cec600c144b807de17245ecc8bc 100644 (file)
@@ -380,7 +380,7 @@ _bfd_XXi_swap_aux_out (bfd *  abfd,
          H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
        }
       else
-       memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
+       memcpy (ext->x_file.x_fname, in->x_file.x_fname, sizeof (ext->x_file.x_fname));
 
       return AUXESZ;
 
index 9712268bae4320095436c60bcf14e82a522ab751..5ea252c9efc7c141e21e94bd0a1222efd59783d2 100644 (file)
@@ -1,3 +1,8 @@
+2021-03-16  Nick Clifton  <nickc@redhat.com>
+
+       * coff/internal.h (struct internal_auxent): Fix a couple of typos
+       in comment describing the x_fname field.
+
 2021-03-16  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
 
        * opcode/riscv-opc.h: Support zba, zbb and zbc extensions.
index 1b5b45c226661cd48a3755f04016f00f1e3f4e5a..90c901d29873c81992aa1fabc14215085c1bda10 100644 (file)
@@ -580,8 +580,8 @@ union internal_auxent
   union
   {
     /* PR 17754: We use to FILNMLEN for the size of the x_fname
-       array, but that cause problems as PE targets use a larger
-       value.  We cannot use their definition of EFILNMLEN as this
+       array, but that causes problems as PE targets use a larger
+       value.  We cannot use their definition of E_FILNMLEN as this
        header can be used without including any PE headers.  */
     char x_fname[20];
     struct