aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-02-22 00:34:24 -0500
committerJustin M. Keyes <justinkz@gmail.com>2016-02-22 00:34:24 -0500
commitd9291954b9859ecb9dced7eb6e6285bc52b76f17 (patch)
tree78f5ea4b9aa87fb7a34fcd0181d441770af63b3c /src/nvim/eval.c
parent6395dd64a430d8916f72afe807bf4ed8b0de4ea0 (diff)
parente0727ced13bde960cd91690df47d0c989311ef05 (diff)
downloadrneovim-d9291954b9859ecb9dced7eb6e6285bc52b76f17.tar.gz
rneovim-d9291954b9859ecb9dced7eb6e6285bc52b76f17.tar.bz2
rneovim-d9291954b9859ecb9dced7eb6e6285bc52b76f17.zip
Merge pull request #4259 from watiko/vim-7.4.881
vim-patch:7.4.{879,881}
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 94683d22cb..96fc79504f 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -20926,14 +20926,18 @@ call_user_func (
save_sourcing_name = sourcing_name;
save_sourcing_lnum = sourcing_lnum;
sourcing_lnum = 1;
- sourcing_name = xmalloc((save_sourcing_name == NULL ? 0 : STRLEN(save_sourcing_name))
- + STRLEN(fp->uf_name) + 13);
+ // need space for function name + ("function " + 3) or "[number]"
+ size_t len = (save_sourcing_name == NULL ? 0 : STRLEN(save_sourcing_name))
+ + STRLEN(fp->uf_name) + 20;
+ sourcing_name = xmalloc(len);
{
if (save_sourcing_name != NULL
- && STRNCMP(save_sourcing_name, "function ", 9) == 0)
- sprintf((char *)sourcing_name, "%s..", save_sourcing_name);
- else
+ && STRNCMP(save_sourcing_name, "function ", 9) == 0) {
+ vim_snprintf((char *)sourcing_name, len, "%s[%zu]..",
+ save_sourcing_name, save_sourcing_lnum);
+ } else {
STRCPY(sourcing_name, "function ");
+ }
cat_func_name(sourcing_name + STRLEN(sourcing_name), fp);
if (p_verbose >= 12) {