From 2234fd83579d5a5ee93e4b995d280dd5b2d5a889 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Mon, 2 Aug 2021 12:58:01 +0300 Subject: [PATCH] Ticket #4269: (edit_close_cmd): fix use-after-free. The old 'w' pointer became invalid after widget_destroy() call, so we need to get the new widget directly after find_editor. Found using PVS-Studio 7.14 with intermodular analysis mode. Signed-off-by: Sergey Larin Signed-off-by: Andrew Borodin --- doc/NEWS | 2 +- src/editor/editcmd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/NEWS b/doc/NEWS index 2c31edb9e..a576d3043 100644 --- a/doc/NEWS +++ b/doc/NEWS @@ -32,7 +32,7 @@ Version 4.8.27 - Misc - * Code clean up (#4179, #4173) + * Code clean up (#4179, #4173, #4269) * Filehighlight of c++ and h++ files as sources (#4194) * Filehighlight of JSON files as documents (#4250) * Support of alacritty terminal emulator (https://github.com/alacritty/alacritty) (#4248) diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index fae7c7521..77acde2fa 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -1244,7 +1244,7 @@ edit_close_cmd (WEdit * edit) { edit = find_editor (DIALOG (g)); if (edit != NULL) - widget_select (w); + widget_select (WIDGET (edit)); } } -- 2.11.4.GIT