mirror of
https://github.com/neovim/neovim.git
synced 2026-04-28 02:04:10 +00:00
vim-patch:9.1.2133: Another case of buffer overflow with 'helpfile' (#37746)
Problem: Another case of buffer overflow with 'helpfile'. Solution: Leave room for "tags" in the buffer (zeertzjq). closes: vim/vim#1934021d591fb12(cherry picked from commit15061d322d)
This commit is contained in:
committed by
github-actions[bot]
parent
818b97173e
commit
03e68ad5d3
@@ -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++;
|
||||||
xstrlcpy(buf, p_hf, MAXPATHL);
|
xstrlcpy(buf, p_hf, MAXPATHL - STRLEN_LITERAL("tags"));
|
||||||
STRCPY(path_tail(buf), "tags");
|
STRCPY(path_tail(buf), "tags");
|
||||||
#ifdef BACKSLASH_IN_FILENAME
|
#ifdef BACKSLASH_IN_FILENAME
|
||||||
slash_adjust(buf);
|
slash_adjust(buf);
|
||||||
|
|||||||
@@ -238,6 +238,11 @@ func Test_helpfile_overflow()
|
|||||||
let &helpfile = repeat('A', 5000)
|
let &helpfile = repeat('A', 5000)
|
||||||
help
|
help
|
||||||
helpclose
|
helpclose
|
||||||
|
for i in range(4089, 4096)
|
||||||
|
let &helpfile = repeat('A', i) .. '/A'
|
||||||
|
help
|
||||||
|
helpclose
|
||||||
|
endfor
|
||||||
let &helpfile = _helpfile
|
let &helpfile = _helpfile
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user