vim-patch:8.2.3669: buffer overflow with long help argument (#16971)

Problem:    Buffer overflow with long help argument.
Solution:   Use snprintf().
bd228fd097
This commit is contained in:
f380cedric
2022-01-27 14:58:53 +01:00
committed by GitHub
parent 39d6db3899
commit 5182627ce9
2 changed files with 9 additions and 2 deletions

View File

@@ -5071,8 +5071,7 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool
&& ((arg[1] != NUL && arg[2] == NUL)
|| (vim_strchr((char_u *)"%_z@", arg[1]) != NULL
&& arg[2] != NUL))) {
STRCPY(d, "/\\\\");
STRCPY(d + 3, arg + 1);
vim_snprintf((char *)d, IOSIZE, "/\\\\%s", arg + 1);
// Check for "/\\_$", should be "/\\_\$"
if (d[3] == '_' && d[4] == '$') {
STRCPY(d + 4, "\\$");