diff options
author | J Phani Mahesh <phanimahesh@gmail.com> | 2016-07-20 11:05:44 +0530 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-07-20 01:35:44 -0400 |
commit | 92866042d9da660913e34ab6d34b25bac8ba3e9b (patch) | |
tree | 8be49d6be90769a2a7b6f0b069e968882675ea2e | |
parent | 77937c4edd0e559ec66811ea20b103c329627a83 (diff) | |
download | rneovim-92866042d9da660913e34ab6d34b25bac8ba3e9b.tar.gz rneovim-92866042d9da660913e34ab6d34b25bac8ba3e9b.tar.bz2 rneovim-92866042d9da660913e34ab6d34b25bac8ba3e9b.zip |
coverity/150263: s/STRCPY/STRLCPY/, bounds check (#5036)
-rw-r--r-- | src/nvim/ex_cmds.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index da64533708..5de9ac0523 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4821,9 +4821,8 @@ static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname, int mix = FALSE; /* detected mixed encodings */ // Find all *.txt files. - size_t dirlen = STRLEN(dir); - STRCPY(NameBuff, dir); - STRCAT(NameBuff, "/**/*"); + size_t dirlen = STRLCPY(NameBuff, dir, sizeof(NameBuff)); + STRCAT(NameBuff, "/**/*"); // NOLINT STRCAT(NameBuff, ext); // Note: We cannot just do `&NameBuff` because it is a statically sized array @@ -4841,7 +4840,7 @@ static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname, * Open the tags file for writing. * Do this before scanning through all the files. */ - STRCPY(NameBuff, dir); + STRLCPY(NameBuff, dir, sizeof(NameBuff)); add_pathsep((char *)NameBuff); STRNCAT(NameBuff, tagfname, sizeof(NameBuff) - dirlen - 2); fd_tags = mch_fopen((char *)NameBuff, "w"); @@ -5016,7 +5015,7 @@ static void do_helptags(char_u *dirname, bool add_help_tags) char_u **files; // Get a list of all files in the help directory and in subdirectories. - STRCPY(NameBuff, dirname); + STRLCPY(NameBuff, dirname, sizeof(NameBuff)); add_pathsep((char *)NameBuff); STRCAT(NameBuff, "**"); |