mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.0.2010: [security] use-after-free from buf_contents_changed()
Problem: [security] use-after-free from buf_contents_changed() Solution: block autocommands Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -6013,6 +6013,9 @@ buf_contents_changed(buf_T *buf)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// We don't want to trigger autocommands now, they may have nasty
|
||||
// side-effects like wiping buffers
|
||||
block_autocmds();
|
||||
if (ml_open(curbuf) == OK
|
||||
&& readfile(buf->b_ffname, buf->b_fname,
|
||||
(linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM,
|
||||
@@ -6038,6 +6041,8 @@ buf_contents_changed(buf_T *buf)
|
||||
if (curbuf != newbuf) // safety check
|
||||
wipe_buffer(newbuf, FALSE);
|
||||
|
||||
unblock_autocmds();
|
||||
|
||||
return differ;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user