mirror of
https://github.com/neovim/neovim.git
synced 2026-04-06 07:38:31 +00:00
vim-patch:9.1.2132: [security]: buffer-overflow in 'helpfile' option handling (#37735)
Problem: [security]: buffer-overflow in 'helpfile' option handling by
using strcpy without bound checks (Rahul Hoysala)
Solution: Limit strncpy to the length of the buffer (MAXPATHL)
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-5w93-4g67-mm43
0714b15940
Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit db133879b2)
This commit is contained in:
committed by
github-actions[bot]
parent
a3c8c593f2
commit
4792c29969
@@ -2495,7 +2495,7 @@ int get_tagfname(tagname_T *tnp, int first, char *buf)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
tnp->tn_hf_idx++;
|
tnp->tn_hf_idx++;
|
||||||
STRCPY(buf, p_hf);
|
xstrlcpy(buf, p_hf, MAXPATHL);
|
||||||
STRCPY(path_tail(buf), "tags");
|
STRCPY(path_tail(buf), "tags");
|
||||||
#ifdef BACKSLASH_IN_FILENAME
|
#ifdef BACKSLASH_IN_FILENAME
|
||||||
slash_adjust(buf);
|
slash_adjust(buf);
|
||||||
|
|||||||
@@ -232,4 +232,13 @@ func Test_help_using_visual_match()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
|
" This caused a buffer overflow
|
||||||
|
func Test_helpfile_overflow()
|
||||||
|
let _helpfile = &helpfile
|
||||||
|
let &helpfile = repeat('A', 5000)
|
||||||
|
help
|
||||||
|
helpclose
|
||||||
|
let &helpfile = _helpfile
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
Reference in New Issue
Block a user