Skip to content

Commit

Permalink
submodule: check argc count for git submodule--helper clone
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jacob Keller authored and Junio C Hamano committed Mar 1, 2016
1 parent d10e3b4 commit 08e0970
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions builtin/submodule--helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ static int module_clone(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, module_clone_options,
git_submodule_helper_usage, 0);

if (argc)
usage_with_options(git_submodule_helper_usage,
module_clone_options);

strbuf_addf(&sb, "%s/modules/%s", get_git_dir(), name);
sm_gitdir = strbuf_detach(&sb, NULL);

Expand Down

0 comments on commit 08e0970

Please sign in to comment.