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.
This commit is contained in:
Nicolas Hillegeer
2014-05-31 20:12:12 +02:00
committed by Justin M. Keyes
parent 1a031af233
commit 70f28d938c

View File

@@ -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) {