mirror of
https://github.com/neovim/neovim.git
synced 2026-04-21 14:55:33 +00:00
vim-patch:9.1.1172: [security]: overflow with 'nostartofline' and Ex command in tag file (#32739)
Problem: heap-buffer-overflow with 'nostartofline' and Ex command in
tag file.
Solution: Set cursor column when moving cursor to line 1 (zeertzjq).
closes: vim/vim#16796
3ed6659549
This commit is contained in:
@@ -2986,6 +2986,8 @@ static int jumpto_tag(const char *lbuf_arg, int forceit, bool keep_help)
|
||||
secure = 1;
|
||||
sandbox++;
|
||||
curwin->w_cursor.lnum = 1; // start command in line 1
|
||||
curwin->w_cursor.col = 0;
|
||||
curwin->w_cursor.coladd = 0;
|
||||
do_cmdline_cmd(pbuf);
|
||||
retval = OK;
|
||||
|
||||
|
||||
@@ -1696,4 +1696,21 @@ func Test_tag_guess_short()
|
||||
set tags& cpoptions-=t
|
||||
endfunc
|
||||
|
||||
func Test_tag_excmd_with_nostartofline()
|
||||
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||
\ "f\tXfile\tascii"],
|
||||
\ 'Xtags', 'D')
|
||||
call writefile(['f', 'foobar'], 'Xfile', 'D')
|
||||
|
||||
set nostartofline
|
||||
new Xfile
|
||||
setlocal tags=Xtags
|
||||
normal! G$
|
||||
" This used to cause heap-buffer-overflow
|
||||
tag f
|
||||
|
||||
bwipe!
|
||||
set startofline&
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
Reference in New Issue
Block a user