summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2015-07-11 12:58:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-07-12 16:55:23 (GMT)
commit3f4f17b51b30262041a2248ef9f966f6248aed50 (patch)
treefc338012da740171d079e9db003a18e6fcf4f3a1 /diff.c
parentb8767f791c15f119554c1466af60e4f2433ae971 (diff)
downloadgit-3f4f17b51b30262041a2248ef9f966f6248aed50.zip
git-3f4f17b51b30262041a2248ef9f966f6248aed50.tar.gz
git-3f4f17b51b30262041a2248ef9f966f6248aed50.tar.bz2
diff: parse ws-error-highlight option more strictly
Check if a matched token is followed by a delimiter before advancing the pointer arg. This avoids accepting composite words like "allnew" or "defaultcontext" and misparsing them as "new" or "context". Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 34012b4..8af01f1 100644
--- a/diff.c
+++ b/diff.c
@@ -3654,7 +3654,12 @@ static void enable_patch_output(int *fmt) {
static int parse_one_token(const char **arg, const char *token)
{
- return skip_prefix(*arg, token, arg) && (!**arg || **arg == ',');
+ const char *rest;
+ if (skip_prefix(*arg, token, &rest) && (!*rest || *rest == ',')) {
+ *arg = rest;
+ return 1;
+ }
+ return 0;
}
static int parse_ws_error_highlight(struct diff_options *opt, const char *arg)