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>
This commit is contained in:

committed by
Junio C Hamano

parent
717416ca87
commit
7dad263334
@ -186,15 +186,15 @@ static int module_clone(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule--helper clone [--prefix=<path>] [--quiet] "
|
N_("git submodule--helper clone [--prefix=<path>] [--quiet] "
|
||||||
"[--reference <repository>] [--name <name>] [--url <url>]"
|
"[--reference <repository>] [--name <name>] [--depth <depth>] "
|
||||||
"[--depth <depth>] [--path <path>]"),
|
"--url <url> --path <path>"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, module_clone_options,
|
argc = parse_options(argc, argv, prefix, module_clone_options,
|
||||||
git_submodule_helper_usage, 0);
|
git_submodule_helper_usage, 0);
|
||||||
|
|
||||||
if (argc)
|
if (argc || !url || !path)
|
||||||
usage_with_options(git_submodule_helper_usage,
|
usage_with_options(git_submodule_helper_usage,
|
||||||
module_clone_options);
|
module_clone_options);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user