diff options
author | René Scharfe <l.s.r@web.de> | 2015-07-11 14:58:21 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-07-12 09:55:23 -0700 |
commit | 3f4f17b51b30262041a2248ef9f966f6248aed50 (patch) | |
tree | fc338012da740171d079e9db003a18e6fcf4f3a1 /diff.c | |
parent | diff.c: --ws-error-highlight=<kind> option (diff) | |
download | tgif-3f4f17b51b30262041a2248ef9f966f6248aed50.tar.xz |
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.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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) |