diff --git a/src/nvim/tag.c b/src/nvim/tag.c index ce8e75253d..c97f63b62f 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2495,7 +2495,7 @@ int get_tagfname(tagname_T *tnp, int first, char *buf) return FAIL; } tnp->tn_hf_idx++; - xstrlcpy(buf, p_hf, MAXPATHL); + xstrlcpy(buf, p_hf, MAXPATHL - STRLEN_LITERAL("tags")); STRCPY(path_tail(buf), "tags"); #ifdef BACKSLASH_IN_FILENAME slash_adjust(buf); diff --git a/test/old/testdir/test_help.vim b/test/old/testdir/test_help.vim index 77f893a90f..0eb3a2730a 100644 --- a/test/old/testdir/test_help.vim +++ b/test/old/testdir/test_help.vim @@ -238,6 +238,11 @@ func Test_helpfile_overflow() let &helpfile = repeat('A', 5000) help helpclose + for i in range(4089, 4096) + let &helpfile = repeat('A', i) .. '/A' + help + helpclose + endfor let &helpfile = _helpfile endfunc