aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2018-08-20 16:55:05 +0200
committerAndreas Schwab <schwab@suse.de>2018-08-21 10:34:02 +0200
commit9dcbfff1e02778bac6fb723640724c38001a8f0a (patch)
tree2bdfd52855a80405a6892b274959d99235271be8 /gas
parent9cf7e5687f823a1009d25cb25ff653ee8372e517 (diff)
downloadbinutils-9dcbfff1e02778bac6fb723640724c38001a8f0a.zip
binutils-9dcbfff1e02778bac6fb723640724c38001a8f0a.tar.gz
binutils-9dcbfff1e02778bac6fb723640724c38001a8f0a.tar.bz2
Fix invalid strcpy on unterminated buffer
* read.c (do_repeat_with_expander): Use memmove instead of strcpy on unterminated string buffer.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/read.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 366f4c1..5343503 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-21 Andreas Schwab <schwab@suse.de>
+
+ * read.c (do_repeat_with_expander): Use memmove instead of strcpy
+ on unterminated string buffer.
+
2018-08-21 Alan Modra <amodra@gmail.com>
* config/tc-ppc.c (md_assemble): Delay counting of optional
diff --git a/gas/read.c b/gas/read.c
index 1f211b6..f011149 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -3117,7 +3117,8 @@ do_repeat_with_expander (size_t count,
sub = strstr (processed.ptr, expander);
len = sprintf (sub, "%lu", (unsigned long) count);
gas_assert (len < 8);
- strcpy (sub + len, sub + 8);
+ memmove (sub + len, sub + 8,
+ processed.ptr + processed.len - (sub + 8));
processed.len -= (8 - len);
sb_add_sb (& many, & processed);
sb_kill (& processed);