summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-01-04 17:01:55 +0700
committerJunio C Hamano <gitster@pobox.com>2012-01-04 09:39:36 -0800
commite7622ce8c4c3d5c0a596ace7fb34afe0d1e273ef (patch)
treea745fe4c916e31f157f79a8d95d73c0af9e3aa1e /transport.c
parent15b7898c5e9fc6fed9a6064213cfcd08cf7d7314 (diff)
downloadgit-e7622ce8c4c3d5c0a596ace7fb34afe0d1e273ef.tar.gz
Catch invalid --depth option passed to clone or fetchnd/maint-parse-depth
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/transport.c b/transport.c
index c9c8056f9d..7bfbf31f6b 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;