justify: do not copy too many bytes when trimming leading whitespace

This fixes https://savannah.gnu.org/bugs/?57972.

Bug existed since version 4.0, commit 877a6498.
This commit is contained in:
Benno Schulenberg 2020-03-08 15:07:33 +01:00
parent 9d7e62be1a
commit d6beca5dcf

View File

@ -1870,7 +1870,7 @@ void do_justify(bool full_justify)
if (indent_len > 0)
memmove(cutbuffer->data + lead_len,
cutbuffer->data + lead_len + indent_len,
line_len - indent_len + 1);
line_len - lead_len - indent_len + 1);
/* If the marked region ends in the middle of a line, and this line
* has a leading part, check if the last line of the extracted region