summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-05-16 13:26:25 +0200
committerBram Moolenaar <Bram@vim.org>2010-05-16 13:26:25 +0200
commit34b4daf2b78c5d9d23cf8e99af1d51522ac2ab0c (patch)
tree81a4f48751977fa39a3f373f4409285caa765ffd /src/eval.c
parent413756470917e76295643a32b0f6f21b35b2e9ae (diff)
updated for version 7.2.435
Problem: Crash when using bad_char_idx uninitialized. (Patrick Texier) Solution: Don't use bad_char_idx, reproduce the ++bad argument from bad_char.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/eval.c b/src/eval.c
index ef9b6d1c91..be59f9827d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -18309,8 +18309,8 @@ set_cmdarg(eap, oldarg)
# ifdef FEAT_MBYTE
if (eap->force_enc != 0)
len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7;
- if (eap->bad_char_idx != 0)
- len += (unsigned)STRLEN(eap->cmd + eap->bad_char_idx) + 7;
+ if (eap->bad_char != 0)
+ len += 7 + 4; /* " ++bad=" + "keep" or "drop" */
# endif
newval = alloc(len + 1);
@@ -18334,9 +18334,12 @@ set_cmdarg(eap, oldarg)
if (eap->force_enc != 0)
sprintf((char *)newval + STRLEN(newval), " ++enc=%s",
eap->cmd + eap->force_enc);
- if (eap->bad_char_idx != 0)
- sprintf((char *)newval + STRLEN(newval), " ++bad=%s",
- eap->cmd + eap->bad_char_idx);
+ if (eap->bad_char == BAD_KEEP)
+ STRCPY(newval + STRLEN(newval), " ++bad=keep");
+ else if (eap->bad_char == BAD_DROP)
+ STRCPY(newval + STRLEN(newval), " ++bad=drop");
+ else if (eap->bad_char != 0)
+ sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char);
# endif
vimvars[VV_CMDARG].vv_str = newval;
return oldval;