Skip to content

Commit e7622ce

Browse files
pcloudsgitster
authored andcommitted
Catch invalid --depth option passed to clone or fetch
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15b7898 commit e7622ce

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
@@ -472,8 +472,12 @@ static int set_git_option(struct git_transport_options *opts,
472472
} else if (!strcmp(name, TRANS_OPT_DEPTH)) {
473473
if (!value)
474474
opts->depth = 0;
475-
else
476-
opts->depth = atoi(value);
475+
else {
476+
char *end;
477+
opts->depth = strtol(value, &end, 0);
478+
if (*end)
479+
die("transport: invalid depth option '%s'", value);
480+
}
477481
return 0;
478482
}
479483
return 1;

0 commit comments

Comments
 (0)