nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 0568f7a2b61807e8efeb7a2f6d94da7cd3cdc0be
parent 1a28b08694ca4b0403bfaea5505677e8aafeec52
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 28 Feb 2020 12:52:06 +0100

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.

Diffstat:
Msrc/text.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 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;