Skip to content

Commit

Permalink
coverity/13685: silence NUL-termnation fp
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aktau committed May 31, 2014
1 parent 5dda267 commit 378718d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/nvim/memline.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,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) {
Expand Down

0 comments on commit 378718d

Please sign in to comment.