aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/if_cscope.c2
1 files changed, 2 insertions, 0 deletions
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