aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Hillegeer <nicolas@hillegeer.com>2014-05-31 20:12:12 +0200
committerJustin M. Keyes <justinkz@gmail.com>2014-06-12 01:41:03 -0400
commit70f28d938c4ebd01c86f7eefbc5ea991014496e8 (patch)
treebc0cafef559cbce8147da7a16ed4f0f212b6a62a
parent1a031af233b052795718c45fae36d918423e4fdb (diff)
downloadrneovim-70f28d938c4ebd01c86f7eefbc5ea991014496e8.tar.gz
rneovim-70f28d938c4ebd01c86f7eefbc5ea991014496e8.tar.bz2
rneovim-70f28d938c4ebd01c86f7eefbc5ea991014496e8.zip
coverity/13685: silence NUL-termnation fp
It was a false positive, but it can't hurt to "fix" it. Original warning: CID 13685 (#1 of 1): Buffer not null terminated (BUFFER_SIZE) 6. buffer_size: Calling strncpy with a source string whose length (4 chars) is greater than or equal to the size argument (4) will fail to null-terminate b0p->b0_version.
-rw-r--r--src/nvim/memline.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 19c3cfe994..63a05e7b59 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -304,8 +304,7 @@ int ml_open(buf_T *buf)
b0p->b0_magic_int = (int)B0_MAGIC_INT;
b0p->b0_magic_short = (short)B0_MAGIC_SHORT;
b0p->b0_magic_char = B0_MAGIC_CHAR;
- STRNCPY(b0p->b0_version, "VIM ", 4);
- STRNCPY(b0p->b0_version + 4, Version, 6);
+ xstrlcpy(xstpcpy((char *) b0p->b0_version, "VIM "), Version, 6);
long_to_char((long)mfp->mf_page_size, b0p->b0_page_size);
if (!buf->b_spell) {