Skip to content

Commit 8064c5f

Browse files
jacob-kellerdscho
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 <[email protected]> Reviewed-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 7957d9f commit 8064c5f

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
@@ -180,8 +180,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
180180

181181
const char *const git_submodule_helper_usage[] = {
182182
N_("git submodule--helper clone [--prefix=<path>] [--quiet] "
183-
"[--reference <repository>] [--name <name>] [--url <url>]"
184-
"[--depth <depth>] [--path <path>]"),
183+
"[--reference <repository>] [--name <name>] [--depth <depth>] "
184+
"--url <url> --path <path>"),
185185
NULL
186186
};
187187

@@ -191,7 +191,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
191191
if (!path || !*path)
192192
die(_("submodule--helper: unspecified or empty --path"));
193193

194-
if (argc)
194+
if (argc || !url)
195195
usage_with_options(git_submodule_helper_usage,
196196
module_clone_options);
197197

0 commit comments

Comments
 (0)