summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-07-16 21:29:06 +0200
committerBram Moolenaar <Bram@vim.org>2010-07-16 21:29:06 +0200
commit11505dcd2b4bf7ab892549f4ce29c0dbc53aac8b (patch)
tree790df93d62bab79e12c322ac14248a437a957bb1 /src/option.c
parent624c7aa69135777c3705f1ad4feec98af47abcfd (diff)
downloadvim-git-11505dcd2b4bf7ab892549f4ce29c0dbc53aac8b.tar.gz
Fix bad parsing of 'colorcolumn'. (Dominique Pelle)
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/option.c b/src/option.c
index fd763afbf..80eb9424c 100644
--- a/src/option.c
+++ b/src/option.c
@@ -6956,7 +6956,7 @@ check_colorcolumn(wp)
int i;
int j = 0;
- for (s = wp->w_p_cc; *s != NUL && count < 255; ++s)
+ for (s = wp->w_p_cc; *s != NUL && count < 255;)
{
if (*s == '-' || *s == '+')
{
@@ -6967,21 +6967,23 @@ check_colorcolumn(wp)
return e_invarg;
col = col * getdigits(&s);
if (wp->w_buffer->b_p_tw == 0)
- continue; /* 'textwidth' not set, skip this item */
+ goto skip; /* 'textwidth' not set, skip this item */
col += wp->w_buffer->b_p_tw;
if (col < 0)
- continue;
+ goto skip;
}
else if (VIM_ISDIGIT(*s))
col = getdigits(&s);
else
return e_invarg;
color_cols[count++] = col - 1; /* 1-based to 0-based */
-
+skip:
if (*s == NUL)
break;
if (*s != ',')
return e_invarg;
+ if (*++s == NUL)
+ return e_invarg; /* illegal trailing comma as in "set cc=80," */
}
vim_free(wp->w_p_cc_cols);