From f2558890f54722ab31b1e073e9ce844750cd200a Mon Sep 17 00:00:00 2001 From: oni-link Date: Thu, 21 Jan 2016 16:17:57 +0100 Subject: coverity/133858: Out-of-bounds access Allocating insufficient memory for the terminating NUL of the string. False positive, we allocating more memory than we need. --- src/nvim/if_cscope.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim') diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index af3a87211a..476dcc9478 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -1661,6 +1661,8 @@ static void cs_print_tags_priv(char **matches, char **cntxts, // NUL terminate tag string in matches[0]. *ptag_end = NUL; + // The "%s" in cstag_msg won't appear in the result string, so we don't need + // extra memory for terminating NUL. size_t newsize = strlen(cstag_msg) + (size_t)(ptag_end - ptag); char *buf = xmalloc(newsize); size_t bufsize = newsize; // Track available bufsize -- cgit