Commit 916abe91 authored by Fredrik Bergroth's avatar Fredrik Bergroth Committed by Noam Postavsky
Browse files

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 354f9f0f)
parent 9ba51edf
......@@ -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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment