Skip to content

Commit eb77529

Browse files
jacob-kellerdscho
authored andcommitted
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 <[email protected]> Reviewed-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7c26ffd commit eb77529

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

builtin/submodule--helper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ static int module_clone(int argc, const char **argv, const char *prefix)
188188
argc = parse_options(argc, argv, prefix, module_clone_options,
189189
git_submodule_helper_usage, 0);
190190

191+
if (argc)
192+
usage_with_options(git_submodule_helper_usage,
193+
module_clone_options);
194+
191195
strbuf_addf(&sb, "%s/modules/%s", get_git_dir(), name);
192196
sm_gitdir = strbuf_detach(&sb, NULL);
193197

0 commit comments

Comments
 (0)