aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-01-23 01:30:50 +0100
committerGitHub <noreply@github.com>2017-01-23 01:30:50 +0100
commitd4b931deacf61528e902623d38d0f4d314bc1839 (patch)
tree2bf212d045d9c7c729839a1f94503a3f81fa1495 /src/nvim/ex_cmds.c
parent7255f00818af5e8e552e9beac2c9f5ccb86de664 (diff)
parent5ac5c7971c2570746b5226e9e75067688566b7f0 (diff)
downloadrneovim-d4b931deacf61528e902623d38d0f4d314bc1839.tar.gz
rneovim-d4b931deacf61528e902623d38d0f4d314bc1839.tar.bz2
rneovim-d4b931deacf61528e902623d38d0f4d314bc1839.zip
Merge #5995 from ZyX-I/coverity-fixes
coverity fixes
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 69eed33736..cf711552be 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -1408,32 +1408,30 @@ char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp)
}
if (itmp != NULL) {
- strncat(buf, " < ", len);
- strncat(buf, (char *) itmp, len);
+ strncat(buf, " < ", len - 1);
+ strncat(buf, (const char *)itmp, len - 1);
}
#else
// For shells that don't understand braces around commands, at least allow
// the use of commands in a pipe.
strncpy(buf, cmd, len);
if (itmp != NULL) {
- char_u *p;
-
// If there is a pipe, we have to put the '<' in front of it.
// Don't do this when 'shellquote' is not empty, otherwise the
// redirection would be inside the quotes.
if (*p_shq == NUL) {
- p = strchr(buf, '|');
+ char *const p = strchr(buf, '|');
if (p != NULL) {
*p = NUL;
}
}
strncat(buf, " < ", len);
- strncat(buf, (char *) itmp, len);
+ strncat(buf, (const char *)itmp, len);
if (*p_shq == NUL) {
- p = strchr(cmd, '|');
+ const char *const p = strchr((const char *)cmd, '|');
if (p != NULL) {
- strncat(buf, " ", len); // Insert a space before the '|' for DOS
- strncat(buf, p, len);
+ strncat(buf, " ", len - 1); // Insert a space before the '|' for DOS
+ strncat(buf, p, len - 1);
}
}
}