Problem: Invalid memory access when option has duplicate flag.
Solution: Correct pointer computation. (Dominique Pelle, closes #1442)
if (flags & P_FLAGLIST)
{
/* Remove flags that appear twice. */
- for (s = newval; *s; ++s)
+ for (s = newval; *s;)
{
/* if options have P_FLAGLIST and
* P_ONECOMMA such as 'whichwrap' */
/* Remove the duplicated value and
* the next comma. */
STRMOVE(s, s + 2);
- s -= 2;
+ continue;
}
}
else
&& vim_strchr(s + 1, *s) != NULL)
{
STRMOVE(s, s + 1);
- --s;
+ continue;
}
}
+ ++s;
}
}
set whichwrap+=h,l
call assert_equal('b,s,h,l', &whichwrap)
+ set whichwrap=h,h
+ call assert_equal('h', &whichwrap)
+
+ set whichwrap=h,h,h
+ call assert_equal('h', &whichwrap)
+
set whichwrap&
endfunction
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 305,
/**/
304,
/**/