public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tc-cr16.c: Use memmove to concatenate 2 overlapping strings
@ 2020-05-26  2:30 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2020-05-26  2:30 UTC (permalink / raw)
  To: binutils

	PR gas/26041
	* config/tc-cr16.c (md_assemble): Use memmove to concatenate
	2 overlapping strings.
---
 gas/ChangeLog        | 6 ++++++
 gas/config/tc-cr16.c | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 96c78092a0..7aba149af9 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR gas/26041
+	* config/tc-cr16.c (md_assemble): Use memmove to concatenate
+	2 overlapping strings.
+
 2020-05-25  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* config/tc-cr16.c (md_convert_frag): Replace fragP->fr_literal
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index 901838398e..951e9ac7f3 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -2560,8 +2560,11 @@ md_assemble (char *op)
   if (streq ("cinv", op))
     {
      /* Validate the cinv options.  */
+      unsigned int op_len, param_len;
       check_cinv_options (param);
-      strcat (op, param);
+      op_len = strlen (op);
+      param_len = strlen (param) + 1;
+      memmove (op + op_len, param, param_len);
     }
 
   /* MAPPING - SHIFT INSN, if imm4/imm16 positive values
-- 
2.26.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-26  2:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26  2:30 [PATCH] tc-cr16.c: Use memmove to concatenate 2 overlapping strings H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).