mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 04:18:18 +00:00
vim-patch:8.0.1409: buffer overflow in :tags command
Problem: Buffer overflow in :tags command.
Solution: Use vim_snprintf(). (Dominique Pelle, closes vim/vim#2471, closes vim/vim#2475)
Add a test.
132f75255e
This commit is contained in:
@@ -952,7 +952,7 @@ void do_tags(exarg_T *eap)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
sprintf((char *)IObuff, "%c%2d %2d %-15s %5ld ",
|
vim_snprintf((char *)IObuff, IOSIZE, "%c%2d %2d %-15s %5ld ",
|
||||||
i == tagstackidx ? '>' : ' ',
|
i == tagstackidx ? '>' : ' ',
|
||||||
i + 1,
|
i + 1,
|
||||||
tagstack[i].cur_match + 1,
|
tagstack[i].cur_match + 1,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
" test 'taglist' function
|
" test 'taglist' function and :tags command
|
||||||
|
|
||||||
func Test_taglist()
|
func Test_taglist()
|
||||||
call writefile([
|
call writefile([
|
||||||
@@ -56,3 +56,8 @@ func Test_taglist_ctags_etags()
|
|||||||
|
|
||||||
call delete('Xtags')
|
call delete('Xtags')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_tags_too_long()
|
||||||
|
call assert_fails('tag ' . repeat('x', 1020), 'E426')
|
||||||
|
tags
|
||||||
|
endfunc
|
||||||
|
Reference in New Issue
Block a user