From 0568f7a2b61807e8efeb7a2f6d94da7cd3cdc0be Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 28 Feb 2020 12:52:06 +0100 Subject: [PATCH] undo: do not try to paste back an empty cutbuffer Trying to do so would dereference a NULL pointer in copy_node(). This fixes https://savannah.gnu.org/bugs/?57915. Bug existed since before version 2.2.0. --- src/text.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/text.c b/src/text.c index de1f825d..5b312c4a 100644 --- a/src/text.c +++ b/src/text.c @@ -762,7 +762,8 @@ void do_redo(void) case INSERT: redidmsg = _("insertion"); goto_line_posx(u->head_lineno, u->head_x); - copy_from_buffer(u->cutbuffer); + if (u->cutbuffer) + copy_from_buffer(u->cutbuffer); free_lines(u->cutbuffer); u->cutbuffer = NULL; break;