fix invalid memcpy() use in text editor (backspace would call memcpy with overlapping source and destination).

This commit is contained in:
Campbell Barton 2012-04-26 02:24:55 +00:00
parent 3a94746169
commit 2f74471dd9

@ -2652,7 +2652,10 @@ void txt_backspace_char (Text *text)
} while (mrk && mrk->lineno==lineno);
}
memcpy(text->curl->line + text->curc - c_len, text->curl->line + text->curc, text->curl->len-text->curc+1);
/* source and destination overlap, don't use memcpy() */
memmove(text->curl->line + text->curc - c_len,
text->curl->line + text->curc,
text->curl->len - text->curc + 1);
text->curl->len-= c_len;
text->curc-= c_len;