0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.1.0764: [security]: use-after-free when closing a buffer

Problem:  [security]: use-after-free when closing a buffer
Solution: When splitting the window and editing a new buffer,
          check whether the newly to be edited buffer has been marked
          for deletion and abort in this case

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-rj48-v4mq-j4vg

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-10-06 17:31:10 +02:00
parent 818c641b6f
commit 51b62387be
5 changed files with 40 additions and 0 deletions

View File

@@ -497,6 +497,12 @@ can_unload_buffer(buf_T *buf)
return can_unload;
}
int
buf_locked(buf_T *buf)
{
return buf->b_locked || buf->b_locked_split;
}
/*
* Close the link to a buffer.
* "action" is used when there is no longer a window for the buffer.