From: A. Wilcox Date: Thu, 22 Feb 2018 13:00:36 +0000 (+0000) Subject: Fix memory corruption when using memcpy to overwtite a string in place. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=96a94bd954f0e1078ed214b5f68de5a28ec6a8c6;p=thirdparty%2Fbinutils-gdb.git Fix memory corruption when using memcpy to overwtite a string in place. PR 22014 * config/tc-mips.c (mips_lookup_insn): Use memmove to strip the instruction size suffix. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 6eb20f0b86e..3a0bbd7abee 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2018-02-22 A. Wilcox + + PR 22014 + * config/tc-mips.c (mips_lookup_insn): Use memmove to strip the + instruction size suffix. + 2017-12-12 Alan Modra PR 21118 diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 618de6c6e57..1727996db02 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -13956,7 +13956,7 @@ mips_lookup_insn (struct hash_control *hash, const char *start, suffix = 0; if (suffix) { - memcpy (name + opend - 2, name + opend, length - opend + 1); + memmove (name + opend - 2, name + opend, length - opend + 1); insn = (struct mips_opcode *) hash_find (hash, name); if (insn) {