diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 17ca81ed0a..789ae0d161 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2500,7 +2500,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 c9371221d1..21f8633971 100644 --- a/test/old/testdir/test_help.vim +++ b/test/old/testdir/test_help.vim @@ -302,6 +302,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