From 916abe91fd250fc5ed27ec0be7d57421e7908111 Mon Sep 17 00:00:00 2001 From: Fredrik Bergroth Date: Tue, 23 Feb 2016 22:41:16 +1100 Subject: [PATCH] Use memmove instead of memcpy on overlapping regions * src/editfns.c (Ftranspose_regions): Regions may overlap, so use memmove instead of memcpy (bug#19213). Copyright-paperwork-exempt: yes This is a backport from trunk. (cherry picked from commit 354f9f0fc6cc05ed98883447f9b2f37943d79160) --- src/editfns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editfns.c b/src/editfns.c index 360ec12ba98..412745d551d 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4997,7 +4997,7 @@ Transposing beyond buffer boundaries is an error. */) start2_addr = BYTE_POS_ADDR (start2_byte); memcpy (temp, start1_addr, len1_byte); memcpy (start1_addr, start2_addr, len2_byte); - memcpy (start1_addr + len2_byte, start1_addr + len1_byte, len_mid); + memmove (start1_addr + len2_byte, start1_addr + len1_byte, len_mid); memcpy (start1_addr + len2_byte + len_mid, temp, len1_byte); SAFE_FREE (); -- 2.39.2