diff src/eval.c @ 2148:99b225e0dbc1 v7.2.430

updated for version 7.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)
author Bram Moolenaar <bram@zimbu.org>
date Fri, 14 May 2010 20:41:05 +0200
parents e10d3c073449
children 99b00399c7b4
line wrap: on
line diff
--- 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;