summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-01-20 20:44:43 +0100
committerBram Moolenaar <Bram@vim.org>2012-01-20 20:44:43 +0100
commitf31b764c23ae9a91cd6119f57aee6ea80ec480d2 (patch)
tree534ff4ba7b47ee9789801b4e7f80fa2fef0e249e /src/eval.c
parent3ef7cdf0fd040e7247bd395b51b107df0da081ef (diff)
updated for version 7.3.407v7.3.407
Problem: ":12verbose call F()" may duplicate text while trying to truncate. (Thinca) Solution: Only truncate when there is not enough room. Also check the byte length of the buffer.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/eval.c b/src/eval.c
index 16e740f6de..dd1685106f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -22163,8 +22163,12 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
s = tv2string(&argvars[i], &tofree, numbuf2, 0);
if (s != NULL)
{
- trunc_string(s, buf, MSG_BUF_CLEN);
- msg_puts(buf);
+ if (vim_strsize(s) > MSG_BUF_CLEN)
+ {
+ trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
+ s = buf;
+ }
+ msg_puts(s);
vim_free(tofree);
}
}
@@ -22252,8 +22256,12 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
s = tv2string(fc->rettv, &tofree, numbuf2, 0);
if (s != NULL)
{
- trunc_string(s, buf, MSG_BUF_CLEN);
- smsg((char_u *)_("%s returning %s"), sourcing_name, buf);
+ if (vim_strsize(s) > MSG_BUF_CLEN)
+ {
+ trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
+ s = buf;
+ }
+ smsg((char_u *)_("%s returning %s"), sourcing_name, s);
vim_free(tofree);
}
}