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.
This commit is contained in:
Nick Clifton 2016-12-02 15:43:53 +00:00
parent a9752fdf83
commit f5ac6ab387
2 changed files with 5 additions and 1 deletions

View File

@ -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.

View File

@ -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);