Skip to content

Commit 7dad263

Browse files
jacob-kellergitster
authored andcommitted
submodule: fix segmentation fault in submodule--helper clone
The git submodule--helper clone command will fail with a segmentation fault when given a null url or null path variable. Since these are required for proper functioning of the submodule--helper clone subcommand, add checks to prevent running and fail gracefully when missing. Update the usage string to reflect the requirement that the --url and --path "options" are required. 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>
1 parent 717416c commit 7dad263

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/submodule--helper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,15 @@ static int module_clone(int argc, const char **argv, const char *prefix)
186186

187187
const char *const git_submodule_helper_usage[] = {
188188
N_("git submodule--helper clone [--prefix=<path>] [--quiet] "
189-
"[--reference <repository>] [--name <name>] [--url <url>]"
190-
"[--depth <depth>] [--path <path>]"),
189+
"[--reference <repository>] [--name <name>] [--depth <depth>] "
190+
"--url <url> --path <path>"),
191191
NULL
192192
};
193193

194194
argc = parse_options(argc, argv, prefix, module_clone_options,
195195
git_submodule_helper_usage, 0);
196196

197-
if (argc)
197+
if (argc || !url || !path)
198198
usage_with_options(git_submodule_helper_usage,
199199
module_clone_options);
200200

0 commit comments

Comments
 (0)