diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-02-22 19:10:48 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-02-22 19:16:55 -0500 |
commit | 9b99cf4a6e2921e9a114c77956680cb054955827 (patch) | |
tree | b25af9a25cdd46996a5f0caf774afbeb5712d44b | |
parent | 37d60042515f1dd37571f0df3af3936d1b0a9615 (diff) | |
download | rneovim-9b99cf4a6e2921e9a114c77956680cb054955827.tar.gz rneovim-9b99cf4a6e2921e9a114c77956680cb054955827.tar.bz2 rneovim-9b99cf4a6e2921e9a114c77956680cb054955827.zip |
coverity/71532: STRING_OVERFLOW
-rw-r--r-- | src/nvim/ex_cmds.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 4a423269cc..ad21e71c51 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4877,16 +4877,13 @@ helptags_one ( int fi; char_u *s; char_u *fname; - int dirlen; int utf8 = MAYBE; int this_utf8; int firstline; int mix = FALSE; /* detected mixed encodings */ - /* - * Find all *.txt files. - */ - dirlen = (int)STRLEN(dir); + // Find all *.txt files. + size_t dirlen = STRLEN(dir); STRCPY(NameBuff, dir); STRCAT(NameBuff, "/**/*"); STRCAT(NameBuff, ext); @@ -4908,7 +4905,7 @@ helptags_one ( */ STRCPY(NameBuff, dir); add_pathsep((char *)NameBuff); - STRCAT(NameBuff, tagfname); + STRNCAT(NameBuff, tagfname, sizeof(NameBuff) - dirlen - 2); fd_tags = mch_fopen((char *)NameBuff, "w"); if (fd_tags == NULL) { EMSG2(_("E152: Cannot open %s for writing"), NameBuff); |