Skip to content

Commit 6ea9385

Browse files
committed
Merge branch 'nd/maint-parse-depth' into maint
* nd/maint-parse-depth: Catch invalid --depth option passed to clone or fetch
2 parents bc0fe84 + e7622ce commit 6ea9385

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

transport.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,12 @@ static int set_git_option(struct git_transport_options *opts,
474474
} else if (!strcmp(name, TRANS_OPT_DEPTH)) {
475475
if (!value)
476476
opts->depth = 0;
477-
else
478-
opts->depth = atoi(value);
477+
else {
478+
char *end;
479+
opts->depth = strtol(value, &end, 0);
480+
if (*end)
481+
die("transport: invalid depth option '%s'", value);
482+
}
479483
return 0;
480484
}
481485
return 1;

0 commit comments

Comments
 (0)