From: René Scharfe Date: Sat, 11 Jul 2015 12:58:21 +0000 (+0200) Subject: diff: parse ws-error-highlight option more strictly X-Git-Tag: v2.5.0-rc3~6^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3f4f17b51b30262041a2248ef9f966f6248aed50;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/diff.c b/diff.c index 34012b4b63..8af01f149d 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)