Fix buffer overflows in ld when printing translated strings.
authorNick Clifton <nickc@redhat.com>
Tue, 31 Jan 2017 12:07:04 +0000 (12:07 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 31 Jan 2017 12:07:04 +0000 (12:07 +0000)
ld * ldmain.c (add_archive_element): Eliminate string buffer.
* ldlang.c (lang_print_asneeded): Likewise.

ld/ChangeLog
ld/ldlang.c
ld/ldmain.c

index 5c5504c69f10e015591ab87a141fe434fba9541a..7ae428abdd71bffe39a89f492d904a49ffa51f78 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-31  Nick Clifton  <nickc@redhat.com>
+
+       * ldmain.c (add_archive_element): Eliminate string buffer.
+       * ldlang.c (lang_print_asneeded): Likewise.
+
 2017-01-30  Maciej W. Rozycki  <macro@imgtec.com>
 
        * emultempl/mipself.em (ignore_branch_isa): New variable.
index dafc3489fd8f71911d09069fc44de7298a50b121..1396c5b3d1dcb27b7e9398cac379060e06ae855c 100644 (file)
@@ -2035,14 +2035,11 @@ static void
 lang_print_asneeded (void)
 {
   struct asneeded_minfo *m;
-  char buf[100];
 
   if (asneeded_list_head == NULL)
     return;
 
-  sprintf (buf, _("\nAs-needed library included "
-                 "to satisfy reference by file (symbol)\n\n"));
-  minfo ("%s", buf);
+  minfo (_("\nAs-needed library included to satisfy reference by file (symbol)\n\n"));
 
   for (m = asneeded_list_head; m != NULL; m = m->next)
     {
index 1e48b1a2dbbcf37f70e4e723e51c2e888eb1d2e0..e049de36d756fd9def50c7c396f3003cc54d4bc9 100644 (file)
@@ -871,11 +871,7 @@ add_archive_element (struct bfd_link_info *info,
 
       if (!header_printed)
        {
-         char buf[100];
-
-         sprintf (buf, _("Archive member included "
-                         "to satisfy reference by file (symbol)\n\n"));
-         minfo ("%s", buf);
+         minfo (_("Archive member included to satisfy reference by file (symbol)\n\n"));
          header_printed = TRUE;
        }