summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@zimbu.org>2010-05-14 20:41:05 +0200
committerBram Moolenaar <bram@zimbu.org>2010-05-14 20:41:05 +0200
commit032b4bf8688977a6036a19c5830fbc218f4edc3b (patch)
tree8d89a29ac0664ce8a646ecc7eb649b6939fdf37a
parent5567d902658f94452b1a7a8408e1459a92287ac8 (diff)
downloadvim-032b4bf8688977a6036a19c5830fbc218f4edc3b.tar.gz
updated for version 7.2.430v7.2.430v7-2-430
Problem: The ++bad argument is handled wrong, resulting in an invalid memory access. Solution: Use the bad_char field only for the replacement character, add bad_char_idx to store the position. (Dominique Pelle)
-rw-r--r--src/eval.c8
-rw-r--r--src/ex_cmds.h3
-rw-r--r--src/ex_docmd.c4
-rw-r--r--src/version.c2
4 files changed, 10 insertions, 7 deletions
diff --git a/src/eval.c b/src/eval.c
index 43fc7dfe..ef9b6d1c 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 != 0)
- len += (unsigned)STRLEN(eap->cmd + eap->bad_char) + 7;
+ if (eap->bad_char_idx != 0)
+ len += (unsigned)STRLEN(eap->cmd + eap->bad_char_idx) + 7;
# endif
newval = alloc(len + 1);
@@ -18334,9 +18334,9 @@ 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 != 0)
+ if (eap->bad_char_idx != 0)
sprintf((char *)newval + STRLEN(newval), " ++bad=%s",
- eap->cmd + eap->bad_char);
+ eap->cmd + eap->bad_char_idx);
# endif
vimvars[VV_CMDARG].vv_str = newval;
return oldval;
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index a5a9e120..eb472975 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -1152,7 +1152,8 @@ struct exarg
int force_ff; /* ++ff= argument (index in cmd[]) */
#ifdef FEAT_MBYTE
int force_enc; /* ++enc= argument (index in cmd[]) */
- int bad_char; /* ++bad= argument (index in cmd[]) */
+ int bad_char_idx; /* ++bad= argument (index in cmd[]) */
+ int bad_char; /* BAD_KEEP, BAD_DROP or replacement char */
#endif
#ifdef FEAT_USR_CMDS
int useridx; /* user command index */
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index dbb05844..748e3bc6 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4739,7 +4739,7 @@ getargopt(eap)
else if (STRNCMP(arg, "bad", 3) == 0)
{
arg += 3;
- pp = &eap->bad_char;
+ pp = &eap->bad_char_idx;
}
#endif
@@ -4770,7 +4770,7 @@ getargopt(eap)
{
/* Check ++bad= argument. Must be a single-byte character, "keep" or
* "drop". */
- p = eap->cmd + eap->bad_char;
+ p = eap->cmd + eap->bad_char_idx;
if (STRICMP(p, "keep") == 0)
eap->bad_char = BAD_KEEP;
else if (STRICMP(p, "drop") == 0)
diff --git a/src/version.c b/src/version.c
index dc706e7d..111adb54 100644
--- a/src/version.c
+++ b/src/version.c
@@ -682,6 +682,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 430,
+/**/
429,
/**/
428,