aboutsummaryrefslogtreecommitdiff
path: root/ld/deffilep.y
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-09-17 13:57:21 +0000
committerNick Clifton <nickc@redhat.com>2013-09-17 13:57:21 +0000
commit3d4a522e2556c6484f64331af24664ed5e8aa2a3 (patch)
treeb7b4b2375ef5fbea7921d6fd1b043e72cf33e608 /ld/deffilep.y
parent9243dd0e802008bb40747f6e026fbe07a468b7a0 (diff)
downloadfsf-binutils-gdb-3d4a522e2556c6484f64331af24664ed5e8aa2a3.zip
fsf-binutils-gdb-3d4a522e2556c6484f64331af24664ed5e8aa2a3.tar.gz
fsf-binutils-gdb-3d4a522e2556c6484f64331af24664ed5e8aa2a3.tar.bz2
PR ld/15957
* deffilep.y (def_file_add_directive): Avoid readin past end of buffer.
Diffstat (limited to 'ld/deffilep.y')
-rw-r--r--ld/deffilep.y19
1 files changed, 13 insertions, 6 deletions
diff --git a/ld/deffilep.y b/ld/deffilep.y
index 9121f8f..2dd21be 100644
--- a/ld/deffilep.y
+++ b/ld/deffilep.y
@@ -934,13 +934,20 @@ def_file_add_directive (def_file *my_def, const char *param, int len)
if (!diropts[i].param)
{
- char saved;
+ if (tend < pend)
+ {
+ char saved;
- saved = * tend;
- * tend = 0;
- /* xgettext:c-format */
- einfo (_("Warning: .drectve `%s' unrecognized\n"), param);
- * tend = saved;
+ saved = * tend;
+ * tend = 0;
+ /* xgettext:c-format */
+ einfo (_("Warning: .drectve `%s' unrecognized\n"), param);
+ * tend = saved;
+ }
+ else
+ {
+ einfo (_("Warning: corrupt .drectve at end of def file\n"));
+ }
}
lex_parse_string = 0;