diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-10-30 23:29:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-30 23:29:47 +0100 |
commit | 241fe704a52092aad7eff8c1cbf25262bfcf0195 (patch) | |
tree | d5f0a0c7252b41f77c880953aa50b67a06afc2e3 /test/functional/eval/json_functions_spec.lua | |
parent | efa9152852eb40b65876fc1422da72de477d30e6 (diff) | |
download | rneovim-241fe704a52092aad7eff8c1cbf25262bfcf0195.tar.gz rneovim-241fe704a52092aad7eff8c1cbf25262bfcf0195.tar.bz2 rneovim-241fe704a52092aad7eff8c1cbf25262bfcf0195.zip |
pvs/V575: false positive (#7462)
./src/nvim/ex_getln.c:2787:1: error: V575 The 'memcpy' function doesn't
copy the whole string. Use 'strcpy / strcpy_s' function to preserve
terminal null.
We could instead "trick" PVS like this:
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index e79476ab532a..295630693b27 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2782,9 +2782,10 @@ static void ui_ext_cmdline_show(CmdlineInfo *line)
void ui_ext_cmdline_block_append(int indent, const char *line)
{
- char *buf = xmallocz(indent + strlen(line));
+ size_t linelen = strlen(line);
+ char *buf = xmallocz(indent + linelen);
memset(buf, ' ', indent);
- memcpy(buf+indent, line, strlen(line));
+ memcpy(buf + indent, line, linelen);
Array item = ARRAY_DICT_INIT;
ADD(item, DICTIONARY_OBJ((Dictionary)ARRAY_DICT_INIT));
Diffstat (limited to 'test/functional/eval/json_functions_spec.lua')
0 files changed, 0 insertions, 0 deletions