Merge branch 'jx/do-not-crash-receive-pack-wo-head' into maint
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index 87b16d5613adb9046501a1b0b285f9f954abbaa5..0f17ec5506e616b0e1383ad689226c774e0df178 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -3653,7 +3653,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)