]> granicus.if.org Git - vim/commitdiff
updated for version 7.2.430 v7.2.430
authorBram Moolenaar <Bram@vim.org>
Fri, 14 May 2010 18:41:05 +0000 (20:41 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 14 May 2010 18:41:05 +0000 (20:41 +0200)
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)

src/eval.c
src/ex_cmds.h
src/ex_docmd.c
src/version.c

index 43fc7dfe2b1008747f26710653688597f375078a..ef9b6d1c91189824f2b432433d186b68ca5f5515 100644 (file)
@@ -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;
index a5a9e1203a53d4f7f9a3201473d9589871382998..eb472975ed77194415f12c11dbaa8f171a84d930 100644 (file)
@@ -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 */
index dbb058444e759ce593a997bdc968aca938610e13..748e3bc69d005625e20037a962010574b666ad3c 100644 (file)
@@ -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)
index dc706e7d9ccadbc55351525677657401ae23ea22..111adb546c33376bf2208ffe772da36970f6cc13 100644 (file)
@@ -681,6 +681,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    430,
 /**/
     429,
 /**/