mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
vim-patch:9.0.2010: [security] use-after-free from buf_contents_changed()
Problem: [security] use-after-free from buf_contents_changed()
Solution: block autocommands
41e6f7d6ba
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -4223,6 +4223,10 @@ bool buf_contents_changed(buf_T *buf)
|
||||
aco_save_T aco;
|
||||
aucmd_prepbuf(&aco, newbuf);
|
||||
|
||||
// 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,
|
||||
0, 0, (linenr_T)MAXLNUM,
|
||||
@@ -4247,6 +4251,8 @@ bool buf_contents_changed(buf_T *buf)
|
||||
wipe_buffer(newbuf, false);
|
||||
}
|
||||
|
||||
unblock_autocmds();
|
||||
|
||||
return differ;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user