submodule: check argc count for git submodule--helper clone

Extra unused arguments to git submodule--helper clone subcommand were being silently ignored. Add a check to the argc count after options handling to ensure that no extra arguments were left on the argv array. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jacob Keller committed Feb 29, 2016 at 14:58 UTC 08e0970a862aaa3b42c532ad0086bcaabe5108cf
1 file changed +4
builtin/submodule--helper.c
+4
@@ -194,6 +194,10 @@ static int module_clone(int argc, const char **argv, const char *prefix)
194 argc = parse_options(argc, argv, prefix, module_clone_options,
195 git_submodule_helper_usage, 0);
196
197 + if (argc)
198 + usage_with_options(git_submodule_helper_usage,
199 + module_clone_options);
200 +
201 strbuf_addf(&sb, "%s/modules/%s", get_git_dir(), name);
202 sm_gitdir = strbuf_detach(&sb, NULL);
203