Bug 6913 - [PATCH] binutils printf format string errors on Intrepid
Summary: [PATCH] binutils printf format string errors on Intrepid
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-24 01:16 UTC by Anders Kaseorg
Modified: 2009-03-26 18:23 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Kaseorg 2008-09-24 01:16:28 UTC
binutils HEAD and 2.18.50.0.9 fail to compile on Intrepid (which enables
-Wformat-security by default) because of these printf format string errors:

dwarf.c:189: error: format not a string literal and no format arguments
listing.c:1103: error: format not a string literal and no format arguments

diff -u -r1.38 dwarf.c
--- binutils/dwarf.c	1 Aug 2008 14:21:29 -0000	1.38
+++ binutils/dwarf.c	24 Sep 2008 01:11:37 -0000
@@ -186,7 +186,7 @@
   snprintf (buff, sizeof (buff), "%16.16lx ", val);
 #endif
 
-  printf (buff + (byte_size == 4 ? 8 : 0));
+  printf ("%s", buff + (byte_size == 4 ? 8 : 0));
 }
 
 static unsigned long int
diff -u -r1.34 listing.c
--- gas/listing.c	11 Apr 2008 09:06:02 -0000	1.34
+++ gas/listing.c	24 Sep 2008 01:11:37 -0000
@@ -1100,7 +1100,7 @@
   int pos = strlen (field_name);
   char **p;
 
-  fprintf (list_file, field_name);
+  fprintf (list_file, "%s", field_name);
   for (p = &argv[1]; *p != NULL; p++)
     if (**p == '-')
       {
Comment 1 Alan Modra 2008-09-25 01:20:47 UTC
Fixed, thanks!
Comment 2 Javier SM 2009-03-26 18:23:46 UTC
It seems that the problem comes from the gcc version. Compiling with GCC 4.2
(gcc (GCC) 4.2.4 (Ubuntu 4.2.4-3ubuntu4)) works fine.