From: Nguyễn Thái Ngọc Duy Date: Wed, 4 Jan 2012 10:01:55 +0000 (+0700) Subject: Catch invalid --depth option passed to clone or fetch X-Git-Tag: v1.7.8.3~4^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e7622ce8c4c3d5c0a596ace7fb34afe0d1e273ef;p=git.git Catch invalid --depth option passed to clone or fetch Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff --git a/transport.c b/transport.c index c9c8056f9..7bfbf31f6 100644 --- a/transport.c +++ b/transport.c @@ -472,8 +472,12 @@ static int set_git_option(struct git_transport_options *opts, } else if (!strcmp(name, TRANS_OPT_DEPTH)) { if (!value) opts->depth = 0; - else - opts->depth = atoi(value); + else { + char *end; + opts->depth = strtol(value, &end, 0); + if (*end) + die("transport: invalid depth option '%s'", value); + } return 0; } return 1;