Blame SOURCES/git-cve-2018-17456-arbitrary-execution.patch

4e7677
diff -ruN git-2.9.3/builtin/submodule--helper.c git-2.9.3_patched/builtin/submodule--helper.c
4e7677
--- git-2.9.3/builtin/submodule--helper.c	2018-10-24 17:19:08.952614832 +0200
4e7677
+++ git-2.9.3_patched/builtin/submodule--helper.c	2018-10-24 17:15:18.869070834 +0200
4e7677
@@ -332,12 +332,12 @@
4e7677
 	strbuf_reset(&sb);
4e7677
 	strbuf_addf(&sb, "submodule.%s.url", sub->name);
4e7677
 	if (git_config_get_string(sb.buf, &url)) {
4e7677
-		url = xstrdup(sub->url);
4e7677
-
4e7677
-		if (!url)
4e7677
+		if (!sub->url)
4e7677
 			die(_("No url found for submodule path '%s' in .gitmodules"),
4e7677
 				displaypath);
4e7677
 
4e7677
+		url = xstrdup(sub->url);
4e7677
+
4e7677
 		/* Possibly a url relative to parent */
4e7677
 		if (starts_with_dot_dot_slash(url) ||
4e7677
 		    starts_with_dot_slash(url)) {
4e7677
@@ -458,6 +458,7 @@
4e7677
 	if (gitdir && *gitdir)
4e7677
 		argv_array_pushl(&cp.args, "--separate-git-dir", gitdir, NULL);
4e7677
 
4e7677
+	argv_array_push(&cp.args, "--");
4e7677
 	argv_array_push(&cp.args, url);
4e7677
 	argv_array_push(&cp.args, path);
4e7677
 
4e7677
diff -ruN git-2.9.3/submodule-config.c git-2.9.3_patched/submodule-config.c
4e7677
--- git-2.9.3/submodule-config.c	2018-10-24 17:19:08.952614832 +0200
4e7677
+++ git-2.9.3_patched/submodule-config.c	2018-10-24 17:14:53.013897339 +0200
4e7677
@@ -302,6 +302,12 @@
4e7677
 			commit_string, name, option);
4e7677
 }
4e7677
 
4e7677
+static void warn_command_line_option(const char *var, const char *value)
4e7677
+{
4e7677
+	warning(_("ignoring '%s' which may be interpreted as"
4e7677
+		  " a command-line option: %s"), var, value);
4e7677
+}
4e7677
+
4e7677
 struct parse_config_parameter {
4e7677
 	struct submodule_cache *cache;
4e7677
 	const unsigned char *commit_sha1;
4e7677
@@ -327,6 +333,8 @@
4e7677
 	if (!strcmp(item.buf, "path")) {
4e7677
 		if (!value)
4e7677
 			ret = config_error_nonbool(var);
4e7677
+		else if (looks_like_command_line_option(value))
4e7677
+			warn_command_line_option(var, value);
4e7677
 		else if (!me->overwrite && submodule->path)
4e7677
 			warn_multiple_config(me->commit_sha1, submodule->name,
4e7677
 					"path");
4e7677
@@ -367,6 +375,8 @@
4e7677
 	} else if (!strcmp(item.buf, "url")) {
4e7677
 		if (!value) {
4e7677
 			ret = config_error_nonbool(var);
4e7677
+		} else if (looks_like_command_line_option(value)) {
4e7677
+			warn_command_line_option(var, value);
4e7677
 		} else if (!me->overwrite && submodule->url) {
4e7677
 			warn_multiple_config(me->commit_sha1, submodule->name,
4e7677
 					"url");