This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix seg-fault in the linker when attempting to print out a malicious linker script.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f5ac6ab387ef0974f6348ac7febc691fbb6c0eb4

commit f5ac6ab387ef0974f6348ac7febc691fbb6c0eb4
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Dec 2 15:43:53 2016 +0000

    Fix seg-fault in the linker when attempting to print out a malicious linker script.
    
    	PR ld/20910
    	* ldmain.c (main): Prevent evaluation of %<char> sequences when
    	printing out a linker script.

Diff:
---
 ld/ChangeLog | 4 ++++
 ld/ldmain.c  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 1d1c91a..a4b6949 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,9 @@
 2016-12-02  Nick Clifton  <nickc@redhat.com>
 
+	PR ld/20910
+	* ldmain.c (main): Prevent evaluation of %<char> sequences when
+	printing out a linker script.
+
 	PR ld/20911
 	* ldctor.c (ldctor_build_sets): Produce alternative error message
 	if the reloc was being applied to a special section.
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 2f15ba7..41684ba 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -368,7 +368,7 @@ main (int argc, char **argv)
 	  while ((n = fread (buf, 1, ld_bufsz - 1, saved_script_handle)) > 0)
 	    {
 	      buf[n] = 0;
-	      info_msg (buf);
+	      info_msg ("%s", buf);
 	    }
 	  rewind (saved_script_handle);
 	  free (buf);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]